我正在尝试使用 PL/SQL 获取每天的统计数据.
Im trying to get statistics for each day with PL/SQL.
每天都有几个条目,错误的 :-) 我想按天对它们进行分组.
Each day have several entries, bukkets of errors :-) I want to group them by day.
我目前在做什么:
SELECT TO_CHAR(dateTime, 'DD') DAY, TO_CHAR(dateTime, 'MM') MONTH, errormessage
FROM log
WHERE (...)
GROUP BY MONTH, DAY, errormessage
这会导致 ORA-00904:DAY":无效标识符(在 group by 上停止).
This results in ORA-00904: "DAY": invalid identifier (stops on the group by).
有什么帮助吗?:D
SELECT TO_CHAR(dateTime, 'DD') DAY, TO_CHAR(dateTime, 'MM') MONTH, errormessage
FROM log
WHERE (...)
GROUP BY TO_CHAR(dateTime, 'DD'), TO_CHAR(dateTime, 'MM'), errormessage
列别名不适用于GROUP BY
,你需要完整的表达式.
Column aliases are no good for GROUP BY
, you need the full expression.
这篇关于如何在 PL/SQL 中按每天分组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!