Help - Search - Members - Calendar
Full Version: GROUP BY column_number (not column name)
Oracle DBA Forums > Oracle > Oracle Forum
blama
Hi,

I'm looking for a way to clean my SQL Statement.

The statement is like this:
SELECT CASE WHEN(...), COUNT(*) FROM ...
GROUP BY CASE WHEN(...)
Is there a way write the same statement Oracle (10g) with a nicer GROUP BY, e.g. GROUP BY col_1?

Alias are only valid on ORDER BY, not GROUP BY and Google did not return helping results for
'oracle "group by" column number'

Thanks a lot,
Blama
blama
I found http://www.dbforums.com/archive/index.php/t-1022751.html
which says that I have to use the whole CASE again in GROUP BY

(Comment by shoblock on 09-17-04, 10:14)

Does everyone agree?
HAL9000
"Does everyone agree?"

Yes, the GROUP BY must fully match the original condition.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.