Author Topic: User Selection query help needed?  (Read 1723 times)

debbuxton

  • Posts: 23
    • View Profile
User Selection query help needed?
« 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

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
User Selection query help needed?
« Reply #1 on: February 18, 2008, 10:10:43 pm »
Hi Deb,

You're right, my example query here 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
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting