I have a one to many relationship between tables A (columns ID and DESC) and B (columns FK_ID, CODE). ID-> FK_ID.
I’m curious to find the most efficient SQL to select all rows in A where there is a code in B named ‘C1’ but there is NOT a code in B named ‘N1’.
Any help appreciated.
Using
EXISTSandNOT EXISTSwould give the best performance