Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.



1.9k
Accepted
answer

Nevermind got it fixed by the following syntax.

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