【发布时间】:2015-04-14 01:03:54
【问题描述】:
这是运行的 SQL 查询:
SELECT * FROM (`news`) WHERE `country` IS NULL AND `region` IS NULL ORDER BY IFNULL(update_date, `create_date)` DESC
您可能会注意到 create_date 有一些格式错误,我想禁用转义但即使我在 order_by 函数后添加 false 也没有效果。如何解决?非常感谢
$this->db->select('*');
$this->db->from('news');
$this->db->where($data);
$this->db->order_by('IFNULL(update_date,create_date)', 'DESC', false);
$query = $this->db->get();
return $query->result_array();
【问题讨论】:
-
$this->db->order_by('IFNULL(update_date,create_date)', 'DESC', false);我想这可能是因为你有 false in order by。
-
感谢您的回复。无论有无 false 都返回相同的结果
标签: php mysql sql codeigniter