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.

How to sort(orderby) when field name 'order' ::find or queryBuilder?

(sorry my poor english) Hi All!

My table fields : id, personName, order.

How to select field order by (fieldname) 'order' ?
Try:

:find(array('order'=>'order')

:find(array('order'=>'[order]')

:find(array('order'=>'order')

queryBuilder()->orderBy('order'),

queryBuilder()->orderBy('[order]'),

queryBuilder()->orderBy('`order')

if colums select: ' , 'order' as sort' and 'order by sort' working, but the response not in model class. many tables have 'order' field, and not possible rename all field. :(

Thank you! Andrew



114.7k
Accepted
answer

[order] is not working ? You know that ou need probably pass how you want to order ? DESC/ASC ?



6.6k

You mean your column is called order?



320

ehh ... [order] is working, but NULL lower with 0,1 or 2... and i not see change... :(

thank you!