How to feed the list of an inner SELECT to an outer SELECT
For efficiency purposes, that is less MySQL server querie, I would like to have a SELECT inside a SELECT,
so that the outer SELECT will use the data (list) produced by inner SELECT.
So the inner SELECT is like:
SELECT ix_id FROM anoox.submit_web_data WHERE answer = 'yes' AND category = $category';
THEN the Outer SELECT will be something like this:
SELECT email FROM web_for_indexing WHERE id in (2045058, 2071184);
where (2045058, 2071184) is the list composed of the ids returned by the 1st SELECT.
However, if I just do this:
SELECT email FROM web_for_indexing WHERE id in (SELECT ix_id FROM web_data WHERE answer = 'yes' AND category = '$category');
Then the server comes to screeching halt. So that is not an acceptable solution.
So how can one feed the list generated by the 1st SELECT to the 2nd SELECT that results in proper (speedy) outcome?