当前位置: 代码迷 >> Oracle开发 >> 使用to_char函数别号后,使用group by,报错“标识符无效”
  详细解决方案

使用to_char函数别号后,使用group by,报错“标识符无效”

热度:52   发布时间:2016-04-24 06:46:18.0
使用to_char函数别名后,使用group by,报错“标识符无效”
select to_char(sysdate,'yyyy') xxx
from dual d
group by xxx

用to_char(sysdate,'yyyy')作为group by可以,但是为什么别名后不行呢?求原理???
------解决方案--------------------
select * from 
(select to_char(sysdate,'yyyy') xxx
from dual d)
group by xxx

你的别名在group by 的时候 还没有生效呢

  相关解决方案