List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 5 2000 5:46pm
Subject:Re: Query
View as plain text  
At 5:17 PM +0100 10-05-2000, Matt Brookes wrote:
>I have a mySQL question...
>Until the sub query facility is written into mySQL so that I can do a
>'SELECT * FROM table1 WHERE id IN (SELECT id FROM table2)' I have got around
>this problem by using a query and putting the results in a string.
>Hence I first ask 'SELECT id FROM table2' and then place all of those
>results into list and query as follows
>SELECT * FROM table1 WHERE id IN ('x1', 'x2',...,'xn')
>This works just fine. However, the number of records returned by table2 is
>now getting pretty long. So, my question is how long a string can I submit
>to mySQL to parse? If there is a limit then does anyone know another way
>around this problem?

This looks like something that can be converted to a simple join.
Will this do what you want?

SELECT table1.* FROM table1, table2 WHERE =

(If you have the New Riders book, see p. 164, "Rewriting Subselects
that Select Matching Values")


Paul DuBois, paul@stripped
QueryMatt Brookes5 Oct
  • Re: QueryPaul DuBois5 Oct
  • Re: QueryBenjamin Pflugmann5 Oct