I'd recommend doing a subquery.

SELECT DISTINCT EmailAddress
FROM Table1
WHERE EmailAddress NOT IN(SELECT Email FROM Table2)

 From: "sas0riza" [EMAIL PROTECTED]

Hello,

What is the best way to compare 2 columns in 2 different tables?

For instance, both tables have an email column. Table1 has all the 
email addresses, while Table2 holds only the email addresses that 
have replied or completed a form. I want to compare the two and 
return a list of email addresses that haven't replied or completed a 
form yet.

This is what I have, but I'm not sure if it is the proper way:

SELECT Distinct [EmailAddress] 
FROM [db].[dbo].[Table1], [db].[dbo].[Table2]
where [EmailAddress] not like [Email]
GO

Note: Table1 has the column EmailAddress and Table2 has the column 
Email.

It seems to work, but for some reason, I would still get some email 
addresses returned even though a response was received from them.

Any help is greatly appreciated.

Thanks!


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to