[UPHPU] Update a mysql table.

Ben Reece breece at doba.com
Tue Jun 24 12:59:54 MDT 2008


Ash wrote:
> I have a mysql table with about 1000 email addresses of our current 
> clients. About 40 of whom have unsubscribed from our newsletter. I 
> have another database that has 200 names and emails for another list 
> we send to and I want to combine the two lists, but I want to make 
> sure that the people who have unsubbed stay unsubbed. We are combining 
> our emails to be just one email instead of 2 separate ones.
>
> So here's what I have:
>
> List 1
> Name        Email            Unsubbed?
> --------------------------------------------------
> Name 1         email at email.com        N
> Name 2        email2 at email.com    Y
> Name 3        email3 at email.com    N
> Name 4        email4 at email.com    N
> .
> .
> .
> Name 1000    email1000 at email.xcom    N
>
>
> List 2
> Name        Email
> ---------------------------------------------------
> First1        email at email.com
> First2        lal at lala.com
> first3        you at youhoo.com
> First4        email4 at email.com
>
> I want the info from list 2 to be put into list 1 but save the 
> unsubbed tag for those emails who are unsubbed in list 1. List 2 does 
> not have an unsubbed field.
>
> Any easy way to do it?
>
> Ash
>
>
Yeah, it should be pretty simple:

INSERT INTO List1 (name, email, unsubbed) (SELECT name, email, 'N', FROM 
List2)

If you're worried about duplicates, that's pretty simple to avoid, too.  
Just say the word.

Ben


More information about the UPHPU mailing list