I have a query where I select one column which I group and the sum of prices which I want to alias in order to use them in the condition.
The problem is in WHERE as it cant be aliased there but even the Parenthesis/Subselect (Which is the answer to the similar question) example does not help because at the end order by would not work.
Here is my query:
SELECT product_status, SUM(list_price) as sum_prices
FROM OE.PRODUCT_INFORMATION
WHERE (LOWER(product_status) NOT LIKE '%orderable%') AND (sum_prices >= 4000)
GROUP BY product_status;
Output:
ORA-00904: "SUM_PRICES": invalid identifier