docs:mysql:joins

JOINS

Show all rows from table parcels, and only those from the other two tables that match the join criteria (the order makes a difference):

SELECT parcels.*, areas.code, areas.desc,
 owneralts.owner AS altowner,
 owneralts.address as altaddress,
 owneralts.city as altcity,
 owneralts.state as altstate,
 owneralts.zip as altzip,
 owneralts.phone as altphone,
 owneralts.comments as altcomments 
 FROM owneralts 
 RIGHT JOIN areas 
 RIGHT JOIN parcels 
 ON areas.id=parcels.area 
 ON owneralts.owner_id=parcels.alternate_owner_id
 WHERE 1;
  • docs/mysql/joins.txt
  • Last modified: 2008/08/03 00:25
  • by 127.0.0.1