统计未读有已经条数 比如说我查询一个表后得到如下结果name idsa 12b 0c 13d 0ids,0为未读信息其他的数字12,13表示读过(有可能是,15,18之类的)怎么统计处为0的信息有多少条,其他剩下的多少条? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select sum(case when ids=0 then 1 else 0 end) as [未读条数],sum(case when ids!=0 then 1 else 0 end) as [已读条数]from tb select sum(case when ids=0 then 1 else 0 end) as [未读条数],sum(case when ids!=0 then 1 else 0 end) as [已读条数]from (select .....) t select sum(case when ids=0 then 1 else 0 end) as [未读条数],sum(case when ids!=0 then 1 else 0 end) as [已读条数]from (查询结果语句) a 请教在Mysqlworkbench中关联数据库的时候为什么不能写自己的IP,怎么设置? SQL 顺序排列 求解释 java 读取 XML 的一个问题。。。。。弄了三天都没有弄出来,求大师帮助 Linked Server 高分求解一题目的SQL语句 请教有关"在线考试系统"的安全问题 ,谢谢 如何将SELECT COUNT(*)的结果存入一变量? 请问有谁知道SQL SERVER的比较用户名和密码的存储过程是哪个呀? 请教一个MSSQL储存过程编写 怎么在作业中屏蔽除零错误? 有没有朋友知道哪家网站可以实时公布 "钢 "和“不锈钢”的价格?
sum(case when ids=0 then 1 else 0 end) as [未读条数],
sum(case when ids!=0 then 1 else 0 end) as [已读条数]
from tb
sum(case when ids=0 then 1 else 0 end) as [未读条数],
sum(case when ids!=0 then 1 else 0 end) as [已读条数]
from (select .....) t
sum(case when ids=0 then 1 else 0 end) as [未读条数],
sum(case when ids!=0 then 1 else 0 end) as [已读条数]
from (查询结果语句) a