On 17.05.2010, at 16:53, Murray Cumming wrote:
> Here's a silly example that shows the need for the name, because using
> the table name would be ambiguous:
>
> SELECT "albums"."album_id", "albums"."name",
> "albums"."artist_singer_id", "relationship_artist_singer"."name",
> "albums"."artist_drummer_id", "relationship_artist_drummer"."name",
> FROM "albums"
> LEFT JOIN "artists"
> AS "relationship_artist_singer"
> ON ("albums"."artist_singer_id" =
> "relationship_artist_singer"."artist_id")
> LEFT JOIN "artists"
> AS "relationship_artist_drummer"
> ON ("albums"."artist_drummer_id" =
> "relationship_artist_drummer"."artist_id")
> WHERE "albums"."album_id" = 123
Vivien says, that you are setting alias not for join, but for table, which is joined.
Better illustrated by different formatting:
FROM
"albums"
LEFT JOIN
"artists" AS "relationship_artist_singer"
ON ("albums"."artist_singer_id" = "relationship_artist_singer"."artist_id")
LEFT JOIN
"artists" AS "relationship_artist_drummer"
ON ("albums"."artist_drummer_id" = "relationship_artist_drummer"."artist_id")
Attachment:
smime.p7s
Description: S/MIME cryptographic signature