|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
query help
Hi, Im trying to do a query to extract all the records from one table that are not in another table. Essentially the unique records from two tables. Not sure of the query though. Any ideas. Thanks
|
|
#2
|
|||
|
|||
|
Something like this:
SELECT * FROM Table1 WHERE MyId NOT IN (SELECT AnotherMyId FROM Table2) |
|
#3
|
|||
|
|||
|
Alternatively
select * from table1 where not exists( select 1 from table2 where table2.id = table1.id) This is usually faster. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > query help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|