Here's an elementary problem I can't figure out. Let's say I have Table, which has 10K rows and 30 columns.
I also have List, which is a .csv list with 1K rows and 2 columns.
With List, one of those columns is an email address, and the other is the value "1", which is meant to go into a specific column on Table. All of the email addresses on List already exist in Table, but not all the addresses on Table are on List.
My goal is, within Table, for all the addresses found on List, to set "Mangoes"=1 while leaving Oranges and Apples unchanged.
So Table is like this:
- UserID | Email | Oranges | Mangoes | Apples |
List is like this:
And I'm trying to get Table, only for those cases where a given email is on List, to look like this:
- UserID | Email | Oranges | 1 | Apples |
What would be the easiest way to do this? (I'm assuming this can be done either via PHP or by turning List into a Table...) Thanks! :)
update table set column = 1 where email in ( select email from list_table)
That's off the top of my head...syntax may be slightly off, but that's the general idea.
posted by Jimbob at 8:42 PM on November 18, 2010 [1 favorite]