Forum Moderators: open

Message Too Old, No Replies

Access SQL Help

         

andrewsmd

6:57 pm on Jul 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have an access database for a client. It stores users with all of their login/personal info. There is another table in the database called registrations. If a user is in the table registrations, then he/she is a member. I need to be able to send emails to all members all non members or both. The problem I am running into is sending an email to all non members. Basically, I need to be able to send and email to all users who are not in the registrations table but are in the the users table. Emails get sent from a table we have that stores email information. Here is the syntax on how I would send an email to all members.

"insert into tblQueue (QueueEMail, QueueSubject, QueueBody) select EMail, '" & _
NsraShared.safequotes(MailSubject) & "', '" & NsraShared.safequotes(MailBody) & _
"' from (((tblUsers " & _
"inner join tblUserGroups on tblUsers.UserID = tblUserGroups.UserID )" & _
"inner join tblUserTypes on tblUserTypes.UserId = tblUsers.UserID )" & _
"inner join tblRegistrations on tblRegistrations.UserId = tblUsers.UserId)" & _
"where UserInactive = false and tblUsers.EMail is not null group by email"

What I don't know how to do is that same query except send to only people who aren't in the tblRegistrations. Any suggestions? Thanks,

vincevincevince

6:42 am on Jul 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In MySQL you can do something like: WHERE id NOT IN (SELECT id FROM tblRegistrations)