简单sql语句
comment表
id newId commenttext isDelete
1 2 aaaaa 0
2 2 bbbbb 0
3 2 ccccc 0
4 2 ddddd 1
5 3 fffff 0
查出newId=2 一共回复数和不包含删除的回复数
newid replycount replycountall
2 3 4
------解决方案--------------------select [newId],replycount =sum(case when isDelete=1 then 0 else 1 end),count(1) replycountall from tb