如下语句
with cte
as 
(select xn||'学年第'||xq||'学期' as xnxq,kcmc,mcjn,mcjx from cjbmaxview where xh='20083294' and (cxbj=0 or cxbj is null))
,cte1 as
(select xn||'学年第'||xq||'学期' as xnxq,kcmc,mcjn,mcjx from cjbmaxview where xh='20083294' and cxbj=1)
select cte.xnxq,cte.kcmc,case greatest(cte.mcjn,nvl(cte1.mcjn,0)) when cte.mcjn then cte.mcjx else cte1.mcjx end as cj from cte left join cte1 on 
cte.kcmc=cte1.kcmc and cte.xnxq=cte1.xnxq group by cte.xnxq,cte.kcmc,cte.mcjn,cte.mcjx,cj order by cte.xnxq报错 ORA-00904: "CJ":invalid identifier
百思不解!麻烦高手指点一下