美文网首页Java
ORA-00937: not a single-group gr

ORA-00937: not a single-group gr

作者: 一觉睡到丶小时候 | 来源:发表于2020-04-08 08:33 被阅读0次
        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
    

    个人博客
    腾讯云社区
    掘金
    CSDN
    公众号:

    wx.jpg

    相关文章

      网友评论

        本文标题:ORA-00937: not a single-group gr

        本文链接:https://www.haomeiwen.com/subject/pzczphtx.html