|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Select unmatched records from two tables of SQL
Hi All,
I have two tables Table1 and Table2 with some records SLIPNO is the common column in both tables and primarykey is set to this column in table1 There are many records in table1 and some of these records (not all) are updated into table2. Now I want retrieve from table1 the records not updated into the table2. For example in table1 there are records 1,2,3,4,5,6,7,8,9 And in table2 there are 3,4,7,9 Now How can I retrieve these records form table1 1,2,5,6 those not updated into table2 I wrote this query : SELECT Table1.SLIPNO, Table1.DATE, Table1.C_NAME, Table1.B_NAME FROM [Table1] INNER JOIN Table2 ON Table1.SLIPNO <>Table2.SLIPNO; But the expected result not coming. This query lists all the records repeating each one record manytimes Can any body give me solution to get the expected result. Klari |
|
#2
|
|||
|
|||
|
U can use below query..
SELECT Table1.SLIPNO, Table1.DATE, Table1.C_NAME, Table1.B_NAME FROM [Table1] LEFT OUTER JOIN Table2 ON Table1.SLIPNO =Table2.SLIPNO where Table2.SLIPNO is null Jefy |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Select unmatched records from two tables of SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|