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

前端 未结 4 1801
走了就别回头了
走了就别回头了 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:28

    Something like

    select * from jobs where jobId not in 
              (select jobId from jobs where resultType = 1)
    

提交回复
热议问题