List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:July 10 2004 1:04am
Subject:USING() and more than one JOIN
View as plain text  
I'm curious if USING() works with more than one join. I can't seem to get it
to work.

http://dev.mysql.com/doc/mysql/en/JOIN.html


The USING (column_list) clause names a list of columns that must exist in
both tables. 
The following two clauses are semantically identical: 

a LEFT JOIN b USING (c1,c2,c3)
a LEFT JOIN b ON a.c1 = b.c1 AND a.c2 = b.c2 AND a.c3 = b.c3

How would you do something like

a LEFT JOIN b ON a.c1 = b.c1
   LEFT JOIN c ON c.c2 = a.c2

I thought it would be as simple as

a LEFT JOIN b USING (c1) 
   LEFT JOIN c USING (c2)

But it fails.

Thread
USING() and more than one JOINDaevid Vincent10 Jul