Implementation: Query records in a that are not associated with b
1、select id from a left join b on a.id = b.aid where b.id is null and status = 1
2、select id from a where id not in (select aid from b) and status = 1
Which one is better, or if there is another way, please leave the answer
not existsCorrect answer
I want to use not exists
A brief discussion on the difference between in and not in, exists and not exists in sql