In article <[EMAIL PROTECTED]>,
Jeff Gannaway <[EMAIL PROTECTED]> writes:

> I've got one huge table (table a), and two smaller tables (tables b and c)
> I need to find which records in 'table a' are not in 'table b' nor are
> they in 'table c'.

> The Primary Key for all 3 tables is 'ProductID'.

> I looked at the LEFT JOIN command in the docs, but it looks like you
> can only compare 1 table to 1 table.

> How do I do this?

With MySQL 4.1.x you can do

  SELECT a, b
  FROM a
  LEFT JOIN (SELECT b FROM b UNION SELECT c FROM c) AS x ON x.b = a.a
  WHERE x.b IS NULL;

The workaround for older versions would be a temporary table.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to