我想离开加入一个有三个条件的表。 等,
$this->db->select('c.*, s.salary_id', FALSE);
$this->db->from('clock_i_o c');
$this->db->join('salary s', 'c.cio_thrp_id = s.salary_thrp_id AND YEAR(c.cio_time) = s.salary_year AND WEEK(c.cio_time) = s.salary_week AND WEEK(c.cio_time) <> WEEK(NOW())', 'left');
问题是ci会自动添加重音到像YEAR,WEEK这样的mysql函数。
和查询变得像,
... LEFT JOIN `salary` `s` ON `c`.`cio_thrp_id` = `s`.`salary_thrp_id` AND `YEAR`(c.cio_time) = s.salary_year AND `WEEK`(c.cio_time) = s.salary_week AND `WEEK`(c.cio_time) <> WEEK(NOW())
我想删除这些重音。感谢
答案 0 :(得分:1)
根据文档,有第4个参数 试试这个:
$this->db->join('salary s', 'c.cio_thrp_id = s.salary_thrp_id AND YEAR(c.cio_time) = s.salary_year AND WEEK(c.cio_time) = s.salary_week AND WEEK(c.cio_time) <> WEEK(NOW())', 'left', false);
Fore mor信息请参阅文档here