We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Accessing calculated alias in SELECT

Im using modelsManager. Is there any way to set maybe user variable or use alias in phql to acces aliased calculated column ? In mysql you can just do (SELECT THIS_CALCULATED ALIAS) and its working but it doesnt in phalcon.

Are you referring to a query similar to:

SELECT
    MAX(`some_column`) AS `maximum`
FROM
    `some_table`

Yes, and then i want use maximum in another column for some calculation, i tried (SELECT maximum) as well @maxium := before and then use @maximum but both solutions doesnt seems to work.

I guess you'd need to switch to raw sql (with PDO). PHQL is for those not requiring any specifics I guess.