SELECT "ENGINEERING_COMPliANCE"."EO" AS "EO","ENGINEERING_COMPliANCE"."AC" AS "AC","ENGINEERING_COMPliANCE"."PN" AS "PN","ENGINEERING_COMPliANCE"."PN_SN" AS "PN_SN","ENGINEERING_COMPliANCE"."HOURS_reset" AS "HOURS_reset","ENGINEERING_COMPliANCE"."MINUTES_reset" AS "MINUTES_reset","ENGINEERING_COMPliANCE"."CYCLES_reset" AS "CYCLES_reset","ENGINEERING_COMPliANCE"."reset_DATE" AS "reset_DATE","ENGINEERING_COMPliANCE"."reset_HOUR" AS "reset_HOUR","ENGINEERING_COMPliANCE"."reset_MINUTE" AS "reset_MINUTE",MAX ( "ENGINEERING_COMPliANCE"."reset_DATE" ) AS "LAST_COMP_DATE" FROM ENGINEERING_COMPliANCEGROUP BY ( "ENGINEERING_COMPliANCE"."EO" ),( "ENGINEERING_COMPliANCE"."AC" ),( "ENGINEERING_COMPliANCE"."PN" ),( "ENGINEERING_COMPliANCE"."PN_SN" )
但是我一直收到以下错误:“ORA-00979:不是GROUP BY表达式”
当我删除“GROUP BY”时,我得到:
“ORA-00937:不是单组组功能”
1 – 究竟是什么意思
2 – 声明有什么问题?
为了使它有点清楚:
拿这个例子:
您的SELECT子句中有TransactionID,AccountID,TransactionAmount,TransactionDate,并且在所有日期都需要SUM(TransactionAmount),在这种情况下,如果添加
SELECT TransactionDate,TransactionID,SUM(TransactionAmount) FROM table GROUP BY TransactionDate
然后你会得到一个错误,为什么呢
假设您在20160101上有4笔交易,每笔交易额为1000美元
你的结果期望是
TransDate TransAmt 20140101 4000
在这种情况下,如果您在SELECT子句中引入其他属性,如AccountID和TransactionID,它们将在哪里?这就是为什么我们必须在SELECT子句中包含GROUP子句中的所有属性,除了具有AGGREGATE函数的属性.
总结以上是内存溢出为你收集整理的ORACLE SQL中的MAX()全部内容,希望文章能够帮你解决ORACLE SQL中的MAX()所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)