List:General Discussion« Previous MessageNext Message »
From:Jim Faucette Date:May 30 1999 2:21am
Subject:Re: Emulating subqueries
View as plain text  
Dave Richardson wrote:
> 
> Hi everyone. Two questions:
> 
> Does anybody know when mySQL will support subqueries? Is there an alpha
> version somewhere that I could use that supports subqueries?
> 
> Does anybody know how to simulate the following subquery in mySQL SQL:
> 
>         SELECT * FROM table1 WHERE id IN (SELECT id FROM table2);
> 
> (that's taken directly from 5.2.1 of the manual. If there's an easy way to
> simultate sub-selects, it would be a nice addition to the manual).
> 

You could try a join:
SELECT table1.* FROM table1, table2 WHERE table1.id = table2.id;

But you may really want:
SELECT DISTINCT table1.* FROM table1, table2 WHERE table1.id=table2.id;

  jim...
Thread
Emulating subqueriesDave Richardson30 May
  • Re: Emulating subqueriesJim Faucette30 May