复杂分组统计---表在文件中

select ELT(
INTERVAL(
indoorRSRPAvg,
-140,
-110,
-100,
-90,
-80,
-70,
-44),
'1 <-140',
'2 -140~-110',
'3 -110~-100',
'4 -100~-90',
'5 -90~-80',
'6 -80~-70',
'7 -70~-44',
'8 >-44'
)as '分段',count(indoorRSRPAvg) as '点数',IsHasSigIndoor as '是否有室分' from tangshanqg_mrbuildingstatinfo GROUP BY IsHasSigIndoor,ELT(
INTERVAL(
indoorRSRPAvg,
-140,
-110,
-100,
-90,
-80,
-70,
-44),
'1<-140',
'2 -140~-110',
'3 -110~-100',
'4 -100~-90',
'5 -90~-80',
'6 -80~-70',
'7 -70~-44',
'8 >-44'
)

原文地址:https://www.cnblogs.com/MrLiu2016/p/5856551.html