[UPHPU] Deduping a list
Brandon Stout
hplsbyufan at imapmail.org
Thu Jul 27 11:54:03 MDT 2006
Gary Thornock wrote:
>
> If I were doing it, I'd put both lists into MySQL in separate
> tables and run a query like this to produce the new list:
>
> CREATE TABLE cleaned_list AS
> SELECT a.*
> FROM
> old_list a
> LEFT OUTER JOIN unsub_list b
> ON a.email = b.email
> WHERE b.email IS NULL;
>
> Then you can (if you like) drop the old_list table and use the
> cleaned_list table as the new list.
I would avoid dropping a table and creating a new one. Alternatively,
use Gary's select statement to get an array of valid email addresses.
Perhaps something like:
<?php
$cleaned_list_sql = <<<str
SELECT a.*
FROM
old_list a
LEFT OUTER JOIN unsub_list b
ON a.email = b.email
WHERE b.email IS NULL;
str;
$cleaned_list_arr = mysql_array($cleaned_list_sql);
?>
More information about the UPHPU
mailing list