oracle标识符无效其他原因
出现以下这种原因的可能是除了你的表名和列名没写对 或者大小写问题 或者没加引号 还有可能是你的语句有问题
以下就是问题之一
group by不同于sql 后面不能跟as起的别名!
ORA-00904: "ZHONGLEI": 标识符无效
错误的写法
select count(id) as sbNum
,to_char(create_time, ‘YYYY-MM-DD’)as tian
,to_char(create_time, ‘MM-DD’) as ZHONGLEI
from epidemic_report_info
where create_time >= #{dayStart} and create_time < #{dayEnd} and user_type like ‘S%’
group by tian,ZHONGLEI
order by tian asc
正确的写法
select count(ID) as sbNum
,to_char(CREATE_TIME, ‘YYYY-MM-DD’) as tian
,to_char(CREATE_TIME, ‘MM-DD’) as ZHONGLEI1
from EPIDEMIC_REPORT_INFO
where CREATE_TIME >= #{dayStart} and CREATE_TIME < #{dayEnd} and USER_TYPE like ‘P%’
group by to_char(CREATE_TIME, ‘YYYY-MM-DD’),to_char(CREATE_TIME, ‘MM-DD’)
order by tian asc