On May 14, 2004, at 10:08 AM, [EMAIL PROTECTED] wrote:


Hello Dr. Hipp,
Hello SQLite users,
 I have two tables with data ( persons and products) and a

third table, that cople the Person.ID with the product.ID.

Now I want a left join between the persons and the products,

so I can show all people, and in case they are coppled to a

product, als show the product. All left join syntaxes I can

find are with only two tables.
How does it work with three tables?



you join table a to the xref table and then the xref table to table b.


SELECT p.person_id, p.person_name, r.product_id, r.product_name
FROM persons p LEFT JOIN persons_xref_products x ON p.person_id = x.person_id
LEFT JOIN products r ON x.product_id = r.product_id
WHERE whatever



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to