List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:September 1 1999 10:03pm
Subject:Re: Doubt
View as plain text  
At 18:19, 19990901, Ricardo Cruz wrote:
>I only would like to know, how can I write this sentence in MySQL SQL
>Language:
>
>SELECT t1.field1
>FROM table1 t1
>WHERE t1.field1 
>NOT IN  (SELECT t2.field2 FROM table2) 
>
>I´m feeling that MySQL SQL Language don´t accept statements as
>parameters in the function IN.

Hi, Ricardo.  To accomplish the same thing without using sub-selects,
you can use a LEFT JOIN.  Here is how:

    SELECT t1.field1
    FROM   table1 t1 LEFT JOIN table2 t2 ON (t1.field1 = t2.field2)
    WHERE  t2.field2 IS NULL

MySQL will support sub-selects in version 3.23.24, which is still a
few months away.

Tim
Thread
DoubtRicardo Cruz2 Sep
  • Re: DoubtMicheal Mc Evoy2 Sep
  • Re: DoubtTonu Samuel2 Sep
  • RE: DoubtMike Robinson2 Sep
  • Re: DoubtRalph Graulich2 Sep
  • Re: DoubtThimble Smith2 Sep