I'm using SQL Server 2005 Express.
In my main database table I have many fields but the two following fields are my main concern.
1) email_address
2) unsubscribe
In my secondary database table I have one record only.
1) email_address
What I want to accomplish... I want to compare the email_address of the secondary database table to the email_address of the main database table and if it exist, change the value of the unsubscribe field. (or if I can't do that, then delete the record within the main database table completely.)
I'd really appreciate any help I can get.
Thanks,
Bill
Something like this should work for you.
Code Snippet
UPDATE MyMainTable
SET UnSubscribe = {Put Your Value Here}
FROM MyMainTable m
JOIN MySecondaryTable s
ON m.eMail_Address = s.eMail_Address
If there is a match, [UnSubscribe] is changed, if there is NO match, nothing happens. This will work with multiple rows in the secondary table.
|||I'll try this tonight. Thanks a lot Arnie.
Bill
No comments:
Post a Comment