Help - Two Left Joins to exclude duplicates from two tables ...

Help - Two Left Joins to exclude duplicates from two tables ...

am 30.10.2006 22:07:41 von starman7

i want to exclude email addresses which are in
newsletter_email_addresses which also appear in
mooky_private.sign_ups.email and mooky.newsletter_opt_outs.email.
my query seems to exclude the mooky_private.sign_ups.email but not the
mooky.newsletter_opt_outs.email. any idea why my second left join isn't
working?

thanks,
s7


SELECT
mooky.newsletter_email_addresses.id,
mooky.newsletter_email_addresses.email
FROM
mooky.newsletter_email_addresses
LEFT JOIN
mooky_private.sign_ups
ON
mooky.newsletter_email_addresses.email = mooky_private.sign_ups.email
LEFT JOIN
mooky.newsletter_opt_outs
ON
mooky.newsletter_email_addresses.email =
mooky.newsletter_opt_outs.email
WHERE
mooky.newsletter_email_addresses.newsletter_id = 46
AND
mooky.newsletter_email_addresses.email LIKE '%@%'
AND
mooky_private.sign_ups.email IS NULL
AND
mooky.newsletter_opt_outs.email IS NULL