all my calculations I need to do an additional filter on the results.
Can I use an alias anywhere or is the AS clause just for column
display purposes?
Instead of:
SELECT column1,
column2,
some_complex_statement_using_SUM_AVG_and_a_few_CAS E_statements
AS Total
FROM table_name
HAVING
some_complex_statement_using_SUM_AVG_and_a_few_CAS E_statements
1
Can I have:
SELECT column1,
column2,
some_complex_statement_using_SUM_AVG_and_a_few_CAS E_statements
AS Total
FROM table_name
HAVING
Total > 1
As I understand it, the HAVING clause is used for filtering AFTER
aggregate functions are calculated so the alias SHOULD be available.