Hello!
This one should work:
SELECT
...
FROM
table1 t1
LEFT JOIN table2 t2 USING (code)
LEFT OUTER JOIN table3 t3 USING(code)
WHERE
t1.code = t3.code
OR t3.code IS NULL
;
Mark Colvin wrote:
>I want to select from three tables where there may or may not be a record in
>the third table. Table 1 and 2 have a one to one relationship and table 1
>and 2 both have a one to many relationship with table three. All three
>tables have a column called 'code' and I want to select where code is in
>table one and table1.code = table2.code and table1.code = table3.code. I
>also want the records that are in table 1 and 2 but do not have any any
>record(s) in table three. Is it possible to build a query that would get the
>results into one recordset? I have tried various queries that don't quite
>return what I need. I hope this makes some sort of sense.
>
>
Greetings
Ralf
>
>
--
Ralf Narozny
SPLENDID Internet GmbH & Co KG
Skandinaviendamm 212, 24109 Kiel, Germany
fon: +49 431 660 97 0, fax: +49 431 660 97 20
mailto:[EMAIL PROTECTED], http://www.splendid.de
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php