qq_35335792
柠檬也有梦
2020-06-19 10:58

sqlserver 如何使用count在一条数据中查询呢

  • sql

两个查询sql如何合并在一起呢

select
'区域' as Area,
'名称' as MineName,
count(1) as '在线'
from sys_PointInfo 
where sysCode=121  and Value =0
group by Area,MineName

select
'区域' as Area,
'名称' as MineName,
count(1) as '不在线'
from sys_PointInfo 
where sysCode=121  and (Value !=0 or value is null)
group by Area,MineName 

图片说明

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答