-- t1 and t2 are tables. -- The result shows fields from -- both t1 and t2 together in a single record. SELECT * FROM t1 LEFT JOIN t2 ON (t2.a=t1.a);
Even when you want only one record, you can define a set of joined records and add a WHERE clause to pick out the one you want. SQL will be clever. It will not actually construct the set. That is just how it works conceptually.
You can compose inner joins without even using an explicit JOIN keyword.
SELECT weather.city, weather.temp_lo, weather.temp_hi, weather.prcp, weather.date, cities.location FROM weather, cities WHERE cities.name = weather.city;
Consider tables of authors and quotations. Each author may have many quotations, but each quotation can have only one author. Which table should be A or B, or does it make any difference? I suspect it does not matter. The engine can figure out which is better on its own. I would hope the engine would be smart enough to fetch the quotation record first then find the corresponding author, rather than trying to find all the quotes for each author. You can always try it both ways.
This page is posted
Optional Replicator mirror
Your face IP:[184.108.40.206]
You are visitor number|