Answer the question
In order to leave comments, you need to log in
How to make null values last in the selection?
When I make a request through (new Query()) in Yii2, there is a field in which the value id = null will be.
At the end of the query, when I do an order by, I need to sort so that nulls are at the end.
Just in sql query, I can do it like this: ORDER BY -group.id DESC or using coalesce.
And how to do the same only in ->orderBy(["-group.id" => SORT_DESC])->all(); ?
This field is not accepted.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question