Skip to content
Advertisement

Firebird column unknown on SELECT AS

I have a table of calls and their durations:

I want to select all numbers that called for over 500 seconds in total. My query uses SELECT AS to rename the SUM(...) field so I can reference it in the HAVING clause:

When I run this query in Firebird SQL, I get the following error:

Advertisement

Answer

You can not use the alias in the having clause.

You should use sum in the having clause as follows:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement