i need check there should no client in #personal table has not received abc email.
i writing using self join.. correct way or should write subquery?
my table has list of client ids , email send details.(like email code,event date)
select * #personal join #personal b on a.id=b.id b.emailcode<> 'abc'
or
select * #personal a.id in (select id #personal b.emailcode <>'abc')
select * #personal not exists (select 1 #personal b a.id=b.id , b.emailcode = 'abc')
if id
column not nullable can can use
select * #personal id not in (select id #personal emailcode = 'abc')