it's just example WHERE statement for the data; your query which gathers the "right" emails would be very specific to your business logic, and especially the WHERE statement which decides whether someone gets an email or not;
i just wanted to show, as an example, you don't send to every email in a table, there should be logic.
same thing for distinct email, if someone is in the table more than once, you don't want to look unprofessional by sending them multiple emails.
finally, you can see i was using a udf to make sure an email was valid...no sense trying to send to an empty string, or an email that doesn't have the @ symbol in it.
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!