Jono B Sat Dec 18 07:21:05 -0500 2010

Subject: Order By Field

In MySQL, if you want to apply a custom sort order to your results, you can use something like

1 ORDER BY FIELD(field_name, '3', '1', '2')

Is this possible in phpar?


Kien La Tue Dec 21 18:22:06 -0500 2010

Yeah try this:

1 YourModel::all(array("order" => "FIELD(field_name, '3','1','2')"))
Jono B Wed Dec 22 05:59:18 -0500 2010

To cover something so obscure as this mysql function is incredibly good. I'm astounded at how awesome this library is.

Thank you for all the hard work.

(1-2/2)