select
sum(INSPECTION_PEOPLE) as inspectionPeople,
FILLING_TIME as fillingTime
from ZFTJ_HALF
where REPORT = 1
and AREA_ID_PID ='131100000000'
and FILLING_TIME like '2019%'
[Err] ORA-00937: not a single-group group function
原因:这句话不会运行,因为FILLING_TIME 要求每行都显示,而sum要求统计后再显示,违反了原则。在有组函数的select中,不是组函数的列,一定要放在group by子句中。
select
sum(INSPECTION_PEOPLE) as inspectionPeople,
FILLING_TIME as fillingTime
from ZFTJ_HALF
where REPORT = 1
and AREA_ID_PID ='131100000000'
and FILLING_TIME like '2019%'
GROUP BY FILLING_TIME
wx.jpg
网友评论