SELECT table4.cod, table1.cod, table2.cod, table3.cod
FROM table4
LEFT JOIN table1 ON table4.cod=table1.cod
LEFT JOIN table1 ON table4.cod=table2.cod
LEFT JOIN table1 ON table4.cod=table3.cod
WHERE table1.cod IS NULL
AND table2.cod IS NULL
AND table3.cod IS NULL

I think that should do it, I didn't test it. What you are doing is a left join for all the tables on table4. The left join will retain all the records of table4, and then you filter out any records that have no value in the fields for the other tables.

On Friday, September 12, 2003, at 04:37 AM, ΝΙΚΟΣ ΓΑΤΣΗΣ wrote:

> Hello list
>
> I have a problem. I have 4 tables (in Mysql 3.23). All of them have a > filed
> named cod.
>
> I want a query to find which cod of table1, table2, table3 is/are not > in
> table4.
> cod values in table1, table2, table3 are diferent.
>
> Thank you
> Nikos
>
>
> -- > MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED]
>
>
-- Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


-- MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
  • ... ΝΙΚΟΣ ΓΑΤΣΗΣ
    • ... Brent Baisley
      • ... ΝΙΚΟΣ ΓΑΤΣΗΣ
        • ... Mikhail Entaltsev
          • ... ΝΙΚΟΣ ΓΑΤΣΗΣ
          • ... Kim Kohen
            • ... Victoria Reznichenko
              • ... Kim Kohen

Reply via email to