firebird
firebird copied to clipboard
Defined names does not work in WHERE/HAVING clause
Why does Firebird cannot work with custom aliases for column names in where and having clauses? This is a major lack of functionality because you need to write the same code twice.
Not sure about the performance aspect but doesn't it count(*) twice now instead of just one time?
SELECT BSTU_N_BELEPOSID, COUNT(*) AS AMOUNT
FROM BELEGSTUECKLISTE WHERE BSTU_N_BELEPOSID = 344209
GROUP BY BSTU_N_BELEPOSID
HAVING AMOUNT > 3
Throws exception:
Dynamic SQL Error SQL error code = -206 Column unknown AMOUNT At line 4, column 8
Instead:
SELECT BSTU_N_BELEPOSID, COUNT(*) AS AMOUNT
FROM BELEGSTUECKLISTE WHERE BSTU_N_BELEPOSID = 344209
GROUP BY BSTU_N_BELEPOSID
HAVING COUNT(*) > 3
Using the custom aliases works in every other major DBMS, e.g. MySQL.
SQL Fiddle insists that it works ONLY in MySQL and no other DBMS.
Not sure about the performance aspect but doesn't it count(*) twice now instead of just one time?
It counts only one time.
It would be great if the alias could be used. Will it ever be possible?