且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将包含案例语句的MySql查询转换为Codeigniter活动记录查询

更新时间:2022-11-10 15:22:43

尝试一下

$this->db->set('ati.time_index_default', "CASE WHEN ati.time_index_value = 'PM' THEN acg.group_pm_default ELSE acg.group_am_default END", FALSE);
$this->db->where('s.user_id', 123);
$this->db->update('attendance_time_index ati
join users s on ati.time_index_user_id = s.user_id
join attendance_code_groups acg  on s.user_attendance_code_group = acg.group_id
');