如何为以下查询创建编码器活动记录


How to create the codeigniter active record for the following query?

如何为以下查询创建编码器活动记录?

$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'");

试试这个

      $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();