----- Original Message ----- From: "Richard Reina" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 14, 2004 8:26 AM Subject: left join question
> Is it possible to do two left joins involving three > tables in one query? > > select a.id, a.amount FROM t1 > LEFT JOIN t2 ON (t1.id=t2.id) > > then > > LEFT JOIN t3 ON (t1.id=t3.id) > > Is this even possible? > > Any help would be greatly appreciated. > That's not a problem. For example: select t1.cola, t2.colb, t3, colc from table1 t1 left join table2 t2 on t1.col1 = t2.col1 left join table3 t3 on t2.col4 = t3.col8 where t1.col5 = 'M' order by t2.colb; Note that the second line of the join - left join table3 t3 on t2.col4 = t3.col8 - has nothing preceding the keywords 'left join' on that same line; the 'on' clause is what connects table3 to one of the other tables in the join. table3 could be joined to either table1 or table2 via the 'on' clause. Rhino -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]