Find records that do not have a corresponding record in the same table

前端 未结 4 1800
走了就别回头了
走了就别回头了 2021-01-29 00:57

I have the following table:

 ID | JobID | Data   | ResultType
---------------------------------
  1 | 12345 | XXXX   | 0
  2 | 12345 | YYYY   | 1
  3 | 23456 | A         


        
4条回答
  •  别那么骄傲
    2021-01-29 01:47

    Another way (not tested):

    SELECT JobId FROM Jobs GROUP BY jobId HAVING max(ResultType) = 0
    

提交回复
热议问题