Hello again
My table:
Code:
CREATE TABLE `emlContacts` (
`id` int(10) unsigned NOT NULL auto_increment,
`email` varchar(150) default NULL,
`firstname` varchar(45) default NULL,
`lastname` varchar(45) default NULL,
`unsubscribed` tinyint(1) default '0',
`client_id` int(10) unsigned default NULL,
`list_id` int(10) unsigned default NULL,
`delivery_failure` int(10) unsigned default '0',
PRIMARY KEY (`id`)
)
currently contains just under 13,000 records.
I'm trying to select all the duplicate email addresses for a given list ID. I'm using this query:
Code:
SELECT id, email
FROM emlContacts c
WHERE c.id IN(
SELECT c2.id
FROM emlContacts c2
WHERE Exists (
SELECT email, Count(id)
FROM emlContacts
WHERE emlContacts.email = c2.email
AND emlContacts.list_id = c2.list_id
AND emlContacts.list_id = 23
GROUP BY emlContacts.email
HAVING Count(emlContacts.id) > 1
)
)
AND c.id NOT IN(
SELECT Min(id)
FROM emlContacts AS c3
WHERE Exists (
SELECT email, Count(id)
FROM emlContacts
WHERE emlContacts.email = c3.email
AND emlContacts.list_id = c3.list_id
AND emlContacts.list_id = 23
GROUP BY emlContacts.email
HAVING Count(emlContacts.id) > 1
)
GROUP BY email
)
... and it's simply churning away without actually returning anything. Has been doing for about ten minutes now. Is there anything I can do to make it... well, "work" would be nice
