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

Orderby Multiple columns

I want to order a fetched result with two columns, I am currently able to sort by one column. But the requirement is to order by two, I tried using the below code but it returned error.

$parameters["order"] = array("id DESC", "created DESC"); $jobs = Jobs::find($parameters);

Can anybody guide me in the right direction.



8.2k
Accepted
answer

Nevermind got it fixed by the following syntax.

$parameters["order"] = "created DESC, id DESC";