ListMailPRO Email Marketing Software Forums

ListMailPRO Email Marketing Software Forums => General Help & How-To => Topic started by: debbuxton on February 18, 2008, 04:10:44 pm

Title: User Selection query help needed?
Post by: debbuxton on February 18, 2008, 04:10:44 pm
Hey there,

I did do a search to see if anyone else posted, but couldn't find an answer, so hoping someone might know.

This is the custom user selection query I want to run:

Combine list 33 & 34, then remove any that are on list 37.

The queries that I seen as samples have you only checking 1 list and removing multiple list members. Whereas with this I want to combine multiple lists members, then remove just those that are on a single list.

Server is running mySQL 5.0 if that is helpful.

Thanks in advance!
deb
Title: User Selection query help needed?
Post by: DW on February 18, 2008, 10:10:43 pm
Hi Deb,

You're right, my example query here (http://listmailpro.com/forum/index.php?topic=1440.msg6008#msg6008) takes into account multiple exclusions but not inclusions.

I have not tested this.. but try:
Code: [Select]
a
 WHERE ((a.list = '33'
 AND cnf = '1')
 OR (a.list = '34'
  AND cnf = '1'))
 AND NOT
 EXISTS (
  SELECT *
  FROM lm_users b
  WHERE a.email = b.email
  AND b.list = '37'
  AND cnf = '1'
);

Regards