Differences
This shows you the differences between two versions of the page.
docs:mysql:joins [2007/03/26 00:22] – created billh | docs:mysql:joins [2008/08/03 00:25] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== JOINS ====== | ||
+ | ===== outer joins using more than 2 tables ===== | ||
+ | Show all rows from table parcels, and only those from the other two tables that match the join criteria (the order makes a difference): | ||
+ | <code mysql> | ||
+ | SELECT parcels.*, areas.code, areas.desc, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | FROM owneralts | ||
+ | RIGHT JOIN areas | ||
+ | RIGHT JOIN parcels | ||
+ | ON areas.id=parcels.area | ||
+ | ON owneralts.owner_id=parcels.alternate_owner_id | ||
+ | WHERE 1; | ||
+ | </ |