假设:
select count(*) from XXX group by xxx 先把所有的记录查出来
select count(*) from XXX where succ=1 group by xxx把成功的记录查出来
有没有办法把这两句一起查出来
之前是这么写的
select count(*),if(succ=1,count(*),0) from XXX group by xxx
查出来记录有错。。。求助
...全文
803打赏收藏
怎么把这两条语句合成一句
假设: select count(*) from XXX group by xxx 先把所有的记录查出来 select count(*) from XXX where succ=1 group by xxx把成功的记录查出来 有没有办法把这两句一起查出来 之前是这么写的 select count(*),if(succ=1,count(*),0) from XXX group by xxx 查出来记录有错。。。求助