我在 Oracle Express 中使用了 HR 员工模式,我想选择在特定年份聘用的员工。
SELECT hire_date,
COUNT(*)
FROM employees empl
GROUP BY SUBSTR(hire_date, -4)
ORDER BY empl.hire_date;
hir_date 列的格式为“2011 年 1 月 1 日”,所以我想通过提取最后四个字符来对它们进行分组。
问题是,我遇到以下错误
ORA-00979: not a GROUP BY expression
00979. 00000 - "not a GROUP BY expression"
*Cause:
*Action:
Error at Line: 1 Column: 7
这不可能吗?