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!

refer select field alias in GROUP BY clause

TPD-OpitzApr 3 2015 — edited May 7 2020
  1. SELECT
  2.       col1
  3.     , col2
  4.     , CASE
  5.           WHEN col2 = 'a'
  6.              THEN 1
  7.           ELSE    2
  8.        END AS my_case_1
  9.     , SUM (col3 / col4) AS my_formula_1
  10. FROM
  11.     table1 AS a
  12. WHERE
  13.     my_formula_1 < 1
  14. GROUP BY
  15.       col_a
  16.     , col_b
  17.     , my_case_1;
Comments
Post Details
Added on Apr 3 2015
10 comments
7,590 views