Why Oracle does not support "group by 1,2,3"? [closed]
Actually, when you go by common sense, column aliases can be used in a ORDER BY
or a outer query only. Because, when you do a ORDER by
, it happens only after the rows selection, by that time the alias is available. But during a GROUP BY
, only after the grouping the selection is done, so until grouping is completed, oracle unaware of the column aliases.
i think, it is pretty much straight forward. may be other DBMS support them, implementing some SQL preprocessing.
So, in short, since the SELECT
happens only after GROUP BY
, and as column aliases are made only in SELECT
, oracle dont support it! The programmer too, when understood this, may not have a need for wanting column aliases in grouping. Atleast me.