SQL Where EXISTS


Example

Will select records in TableName that have records matching in TableName1.

SELECT * FROM TableName t WHERE EXISTS (
    SELECT 1 FROM TableName1 t1 where t.Id = t1.Id)