id  captureId  faceId  personId  score  state  81    36        76        76      760      0  82    36        74        74       600     1
  
  83    36        70        70       590     2  84    39       89        89        690     0  85    39       51        51        600     0   86    39       59        59        590     0   87    40       82        82        610     1  88    40       47        47        600     0 我想得到 根据captureId 分组之后 state全等于0的结果集    请大家帮忙写个SQL语句   谢谢了

解决方案 »

  1.   

    select captureId from tb group by captureId having sum(state)=0
      

  2.   


    select * from 你的表名 where captureId  in 
    (
        select captureId  from 你的表名  where state=0 group by captureId
    );
      

  3.   

    这个虽然在这里可以,但是其实是有风险的,而且不是很直观的方法。
    直接用select * from table where state=0 group by captureID.
    用select *才可以保证选出来的是集,直接用state=0就可以保证全部都是state=0,而不会出现其他的组合出来的state=0的情况。谢谢
      

  4.   

    select * from 表名 where state=0 group by captureId 
      

  5.   

    select * from 表名 where state=0 group by captureId