Thursday, July 12, 2007

[sql] Left join to two-away table

Lesson from Yodakawa today on how to left join to a table, and then join to another 2-away table:

select A.id, B.id, B.id
from A left join (B join C on B.id = C.id) on B.id = A.id