Script:
select distinct T1.[Field1]
from [Table1] T1
left outer join [Table2] T2 on T1.[Field1] = T2.[Field2]
where T2.[Field2] is null
Key points:
- Use Left Join to return all rows from Table1, regardless of whether or not there is a matching row in Table2.
- The WHERE T2.Field2 IS NULL clause will restrict the results returned to only those rows where the Field2 returned from Table2 is null: in other words there is NO record in Table2 for that particular value from Table1.
Nessun commento:
Posta un commento