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
。
提前致谢。!!
答案 0 :(得分:0)
select to_char(date_time, 'YYYY'), count(case_id)
from emer_complaint
group by to_char(date_time, 'YYYY');