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.
| Author |
Topic |
|
hibah
Starting Member
1 Post |
Posted - 2008-11-24 : 08:03:48
|
| Hello, How can i write sql stmt were i want to get all the resord in table 1 an dnot in table 2 accoring to 2 feilds in the table f1 and f2. I tried to use "Not In " but it only takes one feild. note the i want to check both feilds not each alone meaning both f and f2 together.Thx Hiba |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-24 : 08:38:50
|
| [code]SELECT t1.*FROM table1 t1LEFT JOIN table2 t2ON t2.f1=t1.f1AND t2.f2=t1.f2WHERE t2.f1 IS NULL [/code] |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-24 : 08:54:03
|
Your closest equivalent is [NOT] EXISTS.SELECT t1.*FROM table1 AS t1WHERE NOT EXISTS (SELECT * FROM Table2 AS t2 WHERE t2.f1 = t1.f1 AND t2.f2 = t1.f2) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|