List:General Discussion« Previous MessageNext Message »
From:Steve Meyers Date:November 10 2001 4:13pm
Subject:Re: Beginner SQL Question
View as plain text  
On Sat, 2001-11-10 at 05:53, John Morton wrote:
> Hi,
> 
> Can someone tell me why this will not work, please
> 
> SELECT * FROM tbl1 WHERE column =(SELECT * FROM tbl2 WHERE intcolumn =
> 15);
> 

There are no subselects in MySQL (yet).  However, they're usually a bad
idea anyway, which is why it's never been such a big rush to get them
in.  In this case, you'd be better served by a join.  Try:

SELECT tbl1.* FROM tbl1, tbl2 WHERE tbl1.column = tbl2.column AND
tbl2.intcolumn = 15;

Steve Meyers

Thread
Beginner SQL QuestionJohn Morton10 Nov
  • Re: Beginner SQL QuestionCarl Troein10 Nov
  • Re: Beginner SQL QuestionSteve Meyers10 Nov
  • Re: Beginner SQL QuestionBruce Ferrell10 Nov
  • Re: Beginner SQL QuestionShankar Unni10 Nov
  • Re: Beginner SQL QuestionNguyen Trong Phuc10 Nov
  • Re: Beginner SQL QuestionNguyen Trong Phuc10 Nov
  • Re: Beginner SQL QuestionShankar Unni10 Nov
  • Re: Beginner SQL QuestionNguyen Trong Phuc10 Nov