Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hello,I am trying to have a query so that the data in tbl2 is not the same as the ones in tblMain. The two fields I am looking are field2 and field3Is my query correct? thanksselect field1, ID, date, field4from tbl2where ID not in (select field3 from tblMain) and date not in (select date from tblMain)
James K
Master Smack Fu Yak Hacker
3873 Posts
Posted - 2013-04-22 : 08:59:51
If you are looking for the combination of field3 and date (rather than one or the other), the syntax should be like this:
select field1, ID, date, field4from tbl2 twherenot exists ( select * from tblMain m where m.field3 = t.ID and m.date = t.date)