SQL Query Execution in PHQL

SELECT * FROM table_name WHERE created_at = "2016-01-26" ORDER BY CAST(change AS SIGNED INTEGER) ASC LIMIT 5;

To use raw sql queries you should take a look here: https://docs.phalcon.io/en/latest/reference/phql.html#using-raw-sql

Phalcon Query Builder requires you to use models and not table names.


i think its because change is reserved word https://dev.mysql.com/doc/refman/5.5/en/keywords.html


CAST([change] AS ... )

Doesn't phalcon support "CAST" keyword.

By the way I got the array from mysql and make php array and use php casting method and use multisort function to sort array.