FYI, when I run the 2 SELECT commands that I listed in original message by themselves, the result is instantaneous.However if I put the 1st SELECT inside the 2nd one as I had written, the server comes to its knees, which obviouslymeans there is something totally wrong with that scheme. So again love to see how your suggestion will make thecombined SELECTs instantaneous as when they are run individually.

Regards.

r937 said:

pretty much exactly like you wroteactually, an INNER JOIN would be even better

but neither of them is going to be efficient if you don't have the right indexes

please do a SHOW CREATE TABLE for each table, and i'll show you how to add the indexes

r937
—
2012-07-29T10:36:17Z —
#4

something doesn't add up here

your inner query uses a column called "answer" in the table called "submit_web_data"

but the SHOW CREATE TABLE you posted was for a table called "web_data" and it's lacking that column

then your query would be this --SELECT web_for_indexing.email FROM submit_web_dataINNER JOIN web_for_indexing ON web_for_indexing.id = submit_web_data.ix_id WHERE submit_web_data.category = $category AND submit_web_data.answer = 'yes'

Mittineague
—
2014-09-20T17:28:51Z —
#6

This topic is now archived. It is frozen and cannot be changed in any way.