Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

GROUP BY 1,2;

BPeaslandDBAMar 2 2015 — edited May 7 2020

I can write a SQL like the following:

SELECT col1,col2,col3 FROM my_table ORDER BY 1,2;

We all know "1,2" is shorthand for the first and second columns in my SELECT clause.

My idea is to do something similar for the GROUP BY clause...

SELECT col1, col2, SUM(col3) FROM my_table GROUP BY 1,2;

Just an idea!
Brian

Comments
Post Details
Added on Mar 2 2015
27 comments
16,168 views