Can I get better performance using a JOIN or using EXISTS?

前端 未结 12 1843
鱼传尺愫
鱼传尺愫 2020-12-03 13:04

I have two tables Institutions and Results and I want to see if there are any results for institutions that way I can exclude the ones that don\'t have results.

Can

12条回答
  •  情话喂你
    2020-12-03 13:58

    Actually, from your vague description of the problem, it sounds to me like a NOT IN query is the most obvious way to code it:

    SELECT *
      FROM Institutions
      WHERE InstitutionID NOT IN (
         SELECT DISTINCT InstitutionID
           FROM Results
         )
    

提交回复
热议问题