List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 7 2001 11:57pm
Subject:Re: NOT IN query problems.
View as plain text  
At 4:40 PM -0700 9/7/01, Anthony E. wrote:
>I've tried to do a NOT IN statement, but still am
>getting SQL syntax error.
>
>
>SELECT COUNT(*) FROM USER_TMP WHERE USER_TMP.email NOT
>IN (SELECT USER.email FROM USER);
>
>I'm trying to produce a list of records from USER_TMP

Huh?  COUNT(*) produces a count, not a list.

>table where the USER_TMP.email is NOT IN USER.email.
>
>(in other words, i want only the records where the
>email address from USER_TMP is not already in USER).
>
>Please help, i've been strugglying on this all day.

You're trying to use a sub-select, and MySQL doesn't
support them yet.  You can probably get what you want
with a LEFT JOIN, however:

SELECT USER_TMP.email FROM USER_TMP LEFT JOIN USER USING (email)
WHERE USER.email IS NULL


>=====
>--
>Anthony Ettinger
>apwebdesign@stripped
>415-504-8048
>http://chovy.com/resume.doc


-- 
Paul DuBois, paul@stripped
Thread
NOT IN query problems.Anthony E.8 Sep
  • Re: NOT IN query problems.Paul DuBois8 Sep