macattack Posted April 30, 2009 Share Posted April 30, 2009 Hello, I'm trying to handle a large CSV file in my mysql. This is my first time dealing with an imported file, and I'm having a few issues. Here's the synopsis of what I'm doing: I receive a file about once per week. This file has ~15,000 names, phone numbers and addresses. During a 30 day period, everyone on the list must be called. I've set up a php file that will take each group from the list and assign it to someone, they do the call and collect the info they need. Here's the problem: I figure the best way to do this is with two tables (I could be mistaken) and the file will be uploaded into one table, the info we collect in the other. They are compared using the ID number in the file. I'm not sure how to begin the process: if someone has not been called yet, they need to be called, and info needs to be collected. When the list is updated, we need to call whoever was not called before. Is there a way to do this with one table, and have the CSV file update the name, phone number and address without affecting the info that we collect? I guess in case this isn't overly clear, if we have already called someone, we don't want to waste time calling them again. It would be appreciated if someone can suggest how I can 1) upload the CSV file without affecting the rest (my thought is the two table solution) and 2) make some kind of query so that only rows where the ID is not on the second list are returned. Once the call is made, a row will be added on the second list with the requisite information and ID number. Thank you in advance for your help. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 30, 2009 Share Posted April 30, 2009 Sounds like a job for a LEFT JOIN. Quote Link to comment Share on other sites More sharing options...
macattack Posted April 30, 2009 Author Share Posted April 30, 2009 Ah. There's a command I've never used before. I've done lots of inner joins, but never left/right. I will give that a try. Thanks. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 30, 2009 Share Posted April 30, 2009 If you left join and the record dont match, the "right" table will be NULL-ed out -- so you can use an "IS NULL" to find them easily. Quote Link to comment Share on other sites More sharing options...
macattack Posted April 30, 2009 Author Share Posted April 30, 2009 Thanks. It appears to work now. There are other issues, but not relating to the question at hand. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.