I have Table1 that has 1000 records and Table2 that has 157 records. Table1 has all the records from Table2.
Shouldn't these queries return the same amount of records (157)?
Thanks.
select count(*) from [Table1] where ID in (select ID from [Table2]) --returns 104 records select count(*) from [Table2] where ID in (select ID from [Table1]) --returns 157 records select count(*) from [Table2] b WHERE EXISTS ( SELECT * FROM [Table1] as a WHERE b.ID = a.ID ) --returns 157 records select count(*) from [Table1] b WHERE EXISTS ( SELECT * FROM [Table2] as a WHERE b.ID = a.ID ) --returns 104 records
VM