List:MySQL on Win32« Previous MessageNext Message »
From:Paul DuBois Date:April 5 2000 8:05pm
Subject:Re: NOT IN SQL command.
View as plain text  
At 2:18 PM +0300 2000-04-05, sinisa@stripped wrote:
>On Tue, 04 Apr 2000, Shail Dahal wrote:
>>Can we have similar command in mysql for this
>>select col1 from tab1 where col1 NOT IN (select col1 from tab2);
>>--Shail Dahal
>>Shail Dahal
>It is on our TODO list. For the moment you can replace the above with:
>select tab1.col1 from tab1,tab2, where tab1.col1 != tab2.col1;

Isn't this one of those LEFT JOIN situations?

SELECT tab1.col1 FROM tab1 LEFT JOIN tab ON tab1.col1 = tab2.col1
     WHERE tab2.col1 IS NULL;

This assumes that tab2.col1 is defined as NOT NULL in the table
definition, though.

Paul DuBois, paul@stripped
NOT IN SQL command.Shail Dahal4 Apr
  • Re: NOT IN SQL command.Steve Ruby4 Apr
  • [META] Re: NOT IN SQL command.Phlip4 Apr
  • Re: NOT IN SQL command.sinisa@mysql.com5 Apr
    • Re: NOT IN SQL command.Paul DuBois6 Apr
      • Re: NOT IN SQL command.Shail Dahal6 Apr
      • Re: NOT IN SQL command.sinisa@mysql.com6 Apr
  • Re: NOT IN SQL command.Jeffrey Thompson5 Apr