Tuesday 28 August 2018
Subscribe to:
Post Comments (Atom)
SELECT *
FROM `contact` `t`
WHERE (unsubscribed='1')
AND t.id NOT IN
(SELECT distinct contact_id
FROM email, campaign
WHERE email.campaign_id = campaign.id
AND campaign.date_sent >= '2012-07-12')
ORDER BY rand()
LIMIT 10000
select id
from contact
where unsubscribed=1
SELECT distinct contact_id
FROM email, campaign
WHERE email.campaign_id = campaign.id
AND campaign.date_sent >= '2012-07-12'
SELECT 1 FROM DUAL WHERE 1 NOT IN (NULL, 2)
SELECT 1 FROM DUAL WHERE 1 NOT IN (2)
NOT IN
and NULL
in MYSQL.NOT EXISTS
instead of NOT IN
:SELECT * FROM `contact` `t`
WHERE (unsubscribed='1')
AND NOT EXISTS (
SELECT * FROM email, campaign
WHERE
email.campaign_id = campaign.id
AND campaign.date_sent >= '2012-07-12'
AND t.id = contact_id
)
ORDER BY rand()
LIMIT 10000
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment