Imagine three data tables A, B and C. A and B share a common variable ID1. B and C share a common variable ID2. Write a pseudo query to get this result: select everything from Table B, with matching records in both Table A and B, but not in Table C.
My version of the answer is below (but I am not sure if it's correct):
Select *
From table_b
Left Join table_a
On table_b.ID1 = table_a.ID1
Where table_b.ID2 NOT IN table_c.ID2
I am very skeptical about if the Where condition would work for the given condition? Please give your opinion on my answer. Thanks!