Results 1 to 3 of 3
Sep 27, 2012, 15:22 #1
- Join Date
- Feb 2005
- Aveiro, Portugal
- 1 Post(s)
- 0 Thread(s)
How to avoid executing mysql queries in nested loop?
I'm having a bit of a problem with a task I was assigned.
I have this old phpmynewsletter database (MySQL backend).
Basically all emails are saved in a table with this structure:
So one same email can be present several times in the table, this is, subscribed in different newsletters (identified by list_id)
What I need to do is update the records so the fields disclaimer1, disclaimer2, gender, dob and region for a specific list_id are the same for the same email registered with other list_id's.
How do I update the record with list_id 33 with the correct values from record with list_id 1?
I'm using PHP and I believe that running updates queries in loops is bad practise. The table has around 610000 records.
Hope somebody can give me some insight on how to accomplish this task.