####按家庭維度統計信號強度
create table Power_STAT
(select
DeviceId,
count(DeviceId) as AllNum,
sum(case when SubdeviceWlanRadioPower >= -67 then 1 else 0 end) as GoodNum,
sum(case when SubdeviceWlanRadioPower <= -68 and SubdeviceWlanRadioPower >= -70 then 1 else 0 end ) as NormalNum,
sum(case when SubdeviceWlanRadioPower <= -71 then 1 else 0 end) as PoorNum
from wide_table_all_row
where SubdeviceWlanRadioPower!= ''
group by DeviceId);
SQL 先分組再分段統計每段個數
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
MySQL數據庫中表不存在錯誤
Cloud-Future
2018-08-27 19:44:36
Mysql ifnull/count group by 空結果集null的問題
galenowow
2018-08-27 19:40:26
解決虛擬機linux端mysql數據庫無法遠程訪問
疾跑的蜗牛
2018-08-27 19:35:01
centos7 安裝mysql57
疾跑的蜗牛
2018-08-27 19:35:00
千遍一律的multi-statement not allow解決方案對我沒用
疾跑的蜗牛
2018-08-27 19:35:00
MySQL存儲引擎--MyISAM與InnoDB區別
疾跑的蜗牛
2018-08-27 19:34:59
MySQL執行計劃解讀
zjjee
2018-08-27 18:29:01
sql之left join、right join、inner join的區別
zjjee
2018-08-27 18:28:53
Mysql create table tb as select 和create table tb like的區別
zjjee
2018-08-27 18:28:52
Windows配置mycat
木子生
2018-08-27 18:17:57
Mysql中的flush privileges語句
木子生
2018-08-27 18:17:46
低成本和高性能的MySQL雲數據庫的實現
清新哥哥
2018-08-27 18:05:52
Mysql在大型網站的應用架構演變
清新哥哥
2018-08-27 18:05:52
通過Java向Ubuntu16.04服務器的數據庫傳輸數據時中文變成問號
King-Yao
2018-08-27 18:00:58