如何为以下查询创建codeigniter活动记录?
$query = $this->db->query("SELECT * FROM `student`JOIN `pay_log` ON
`student`.`student_id` = `pay_log`.`student_id` WHERE (`activity` LIKE '%yr%'
OR `activity` LIKE '%yr1%') AND `class_id` = 'cl123' AND `student`.`status` = 'active'");
答案 0 :(得分:1)
试试这个
$query = $this->db
->select()
->from( 'student as s' )
->join( 'pay_log as p', 's.student_id = p.student_id' )
->where( 'activity LIKE "%yr%" OR activity LIKE "%yr1%"', FALSE )
->where( 'class_id', 'cl123' )
->where( 's.status', 'active' )
->get();