I have two tables
T1 Columns A,B
------------------------
Data 1,2
1,3
3,5
4,6
7,6
T2 Columns A,B
------------------------
Data 1,2
1,5
4,6
Expected Result : Select data from T1, which is not preset in T2
Result Data: A,B
--------------------------
1,3
3,5
7,6
To work out such problem we have 'Minus' operator in oracle, but in MS Sql, we can solve in the following ways......
Solution 1
***********************
Select a,b from T1
Where Not Exists
(Select 1 from T2 Where T1.A = T2.A and T1.B = T2.B)
Solution 2
***********************
select a,b from t1
except
select a,b from t2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment