【发布时间】:2012-03-25 20:28:12
【问题描述】:
select station_id,count(case_id) from emer_complaint group by station_id
上面的查询返回正确的结果。但是,当我尝试此查询以显示年度记录时。然后显示错误ORA-00904: "YEAR": invalid identifier
select year(date_time)
,count(case_id)
from emer_complaint
group by year(date_time);
date_time 的数据类型是Timestamp。
先谢谢了!!
【问题讨论】:
-
您需要
to_char。Year()不是 Oracle 函数。 -
感谢@Ben 的宝贵帮助!!