Subqueries are supported staring with mysql 4.1. I'm guessing you have an earlier version. You can rewrite your query as a join, though.

  SELECT item_id
  FROM new LEFT JOIN old using (item_id)
  WHERE old.item_id IS NULL;

See the manual <http://dev.mysql.com/doc/mysql/en/Rewriting_subqueries.html> for more.

Michael

Richard Williams wrote:

This is my first post so forgive me if I put it in the wrong place or screwed it up in some way.

I have two tables, "new" and "old" and I want to show all rows in one table that do not appear in the other table. I tried this select from the manual section "14.1.8.3 Subqueries with ANY, IN, and SOME"

SELECT item_id FROM new WHERE item_id <> ANY (SELECT item_id FROM old);

but get this error:

ERROR 1064 at line 3: You have an error in your SQL syntax near '(SELECT item_id FROM old)' at line 1

Which I believe is a parse error. I have verified the table names and the column exists in both tables.

Richard



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



Reply via email to