Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> alias name in a group by does not work
Like the topic said:
select
col1,
case when col1 > col3 then 'YES' else 'NO' end as STATUS,
col2
from testtable
group by col1, STATUS;
does not work!?
It results in: ORA-00904 unknown column
The only way to do it:
select
col1,
case when col1 > col3 then 'YES' else 'NO' end as STATUS,
col2
from testtable
group by col1, case when col1 > col3 then 'YES' else 'NO' end;
Is there a way to use the alias name in the group by part anyway? (In other db, i.e. sybase this is no problem ;-) )
Cheers
Christian
Received on Thu May 15 2003 - 06:27:02 CDT
![]() |
![]() |