[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems with left joins.



I'm having a bit of trouble sorting out a query. 

I have three tables, table1 has a foreign key references into the others.  However it is possible for that foreign key to be null.  But I want to do a join across the tables.  If I do a traditional SELECT in the form of:

SELECT table1.*, table2.*, table3.*
FROM table1, table2, table3
WHERE table1.fkey1 = table2.id
AND table1.fkey2 = table3.id;

When table1.fkey1 or table1.fkey2 is null no record appears.  This is to be expected.  I understand this.

I'm used to solving this problem with MySQL like this:

SELECT table1.*, table2.*, table3.*
FROM table1,
LEFT JOIN table2 ON table1.fkey1 = table2.id
LEFT JOIN table3 ON table1.fkey2 = table3.id;

However McKoi has a different syntax.  It requires a table reference before the "LEFT JOIN".  I don't know what to put there.  If I specify table1 McKoi errors about duplicate table references.

How do I solve my problem?

Regards
--
Oliver Jones > Senior Software Engineer > Deeper Design Limited.
oliver@deeper.co.nz  > www.deeperdesign.com > +64 (21) 41-2238