SQL Query Execution in PHQL

SELECT * FROM tablename WHERE createdat = "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.phalconphp.com/en/latest/reference/phql.html#using-raw-sql

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



60.8k

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

try:

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.