i have two table:
declare @t1 table (id int)
declare @t2 table (id int)
insert into @t1
select 1 union select 3 union select 7
insert into @t2
select 1 union select 3 union select 7 union select 9 union select 4
select count(*) from @t1 t inner join @t2 t1 on t.id = t1.id
i get the result for above query as 3. i need true or false if all the records in t1 exists in t2.
this is a simplified example of the real table structure. the real tables may have millions of records, so please let me know some optimized way of doing it
1 Answer