I have a table like this:
People
-----------------
email_address
created_date
I also have a spreadsheet with about 60,000 e-mail addresses in it. I need to select the “created_date” for each e-mail address in the spreadsheet. The way I am currently approaching it is to create one big select statement with an IN clause:
SELECT email_address, created_date FROM People WHERE email_address in (
'user1@something.com',
'user2@something.com',
'user3@something.com',
...
The problem with this is that it is a HUGE script (60,000+ lines) and I can’t even get it to run due to errors like “Got a packet bigger than ‘max_allowed_packet’ bytes” and “MSQL Server has gone away”.
I might be able to fix those errors by increasing max_allowed_packet, etc., but I have a feeling that it might just be a symptom that my SQL sucks and instead of just treating the symptom, I should fix the problem and write better SQL. Let me know if you have any suggestions!
Load the email addresses into a separate, one column table and use