SQL/ORA-00933 SQL 命令未正确结束

SQL/ORA-00933 SQL Command Not Properly Ended

我正在执行以下查询:

select count(*),ACTION_DATE from SUMMARY group by ACTION_DATE where NUM_ACTIONS=500;

这是给我 ORA-00933 SQL 命令没有正确结束,我不确定为什么。

SUMMARY 是 table,ACTION_DATE 和 NUM_ACTIONS 是列。所以我期待的是 num_actions=500.

的每个日期

如果有人能看出命令有什么问题,我们将不胜感激,谢谢

WHERE 子句必须在 GROUP BY.

之前

See oracle documentation about SELECT

SELECT COUNT(*), action_date
FROM summary 
WHERE num_actions = 500
GROUP BY action_date

此错误是由以下原因引起的:

Cause: The SQL statement ends with an inappropriate clause. For example, an ORDER BY clause may have been included in a CREATE VIEW or INSERT statement. ORDER BY cannot be used to create an ordered view or to insert in a certain order.

WHEREGROUP BY

之后

将查询更改为:

SELECT COUNT(*), ACTION_DATE 
FROM SUMMARY 
WHERE NUM_ACTIONS = 500 
GROUP BY ACTION_DATE;