以下是我写的SQL语句 我想先把state=1 过滤掉 然后在根据C.id分组 最后统计个数 select count(*) from ( SELECT row_number() over(order by C.id)id FROM capture AS C INNER JOIN matchlog AS M ON M.captureid=C.id INNER JOIN dvs AS D ON D.id=C.dvsId INNER JOIN bimage AS B ON C.bimageid=B.id WHERE M.state={0} group by C.id )temp
------解决方案-------------------- try 根据你的列名改改
select id,count(id) from (SELECT row_number() over(order by C.id) id,* FROM capture AS C INNER JOIN matchlog AS M ON M.captureid=C.id INNER JOIN dvs AS D ON D.id=C.dvsId INNER JOIN bimage AS B ON C.bimageid=B.id)temp WHERE M.state<>1 group by id