我知道我可以通过使用"when"来实现这一点,但我真的不确定如何在代码点火器中:(
将感谢任何帮助。
$this->db->order_by("time_out = yes","asc"); // something like this
$this->db->where('status','Pending');
$this->db->or_where('status','Kitchen');
$sql = $this->db->get('pedidos');
time_out还有哪些其他值?为什么不按时间排序呢?
您也可以选择if语句:
SELECT *, IF(time_out='yes',1,0) as timeOutSort ......
然后进行
$this->db->order_by("timeOutSort","DESC");