using alias in select statement
Hi,
I have this query:
select systemtype, SUM(CASE WHEN isflash(narserno)=1 THEN 1 ELSE 0 END)*100/COUNT(*) flash,
100-SUM(CASE WHEN isflash(narserno)=1 THEN 1 ELSE 0 END)*100/COUNT(*)
from systemconfig GROUP BY SYSTEMTYPE;
however, i want to replace it with:
select systemtype, SUM(CASE WHEN isflash(narserno)=1 THEN 1 ELSE 0 END)*100/COUNT(*) flash,
100-flash
from systemconfig GROUP BY SYSTEMTYPE;
it does not work and gives me this error:
ORA-00904: "FLASH": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 27 Column: 4
my question is: why does it fail and how to make it work with out running that whole complex sum statement again.
0