Most efficient way to SELECT rows WHERE the ID EXISTS IN a second table
问题 I'm looking to select all records from one table where the ID exists in a second table. The following two queries return the correct results: Query 1: SELECT * FROM Table1 t1 WHERE EXISTS (SELECT 1 FROM Table2 t2 WHERE t1.ID = t2.ID) Query 2: SELECT * FROM Table1 t1 WHERE t1.ID IN (SELECT t2.ID FROM Table2 t2) Are one of these queries more efficient than the other? Should I use one over the other? Is there a third method that I didn't think of that is even more efficient? 回答1: Summary: IN and