I have join table with where in I am wondering if there is a way i can say something like this :
where kd_x in (select kd_x from master_code where a='11921212')
I'm trying to do this with active record like this but is doesn't give me any data
$this->db->where_in('kd_x',array('select kd_x from MT_master where a="11921212"'));
Help me Please, Thank You
->where()
you can use 2nd and 3rd argument, so that any string you can pass
$this->db->where('`kd_x` IN (select `kd_x` from `MT_master` where a="11921212")', NULL, FALSE);
OR
//Create where clause
$this->db->select('kd_x')
->where('a','11921212')
->from('MT_master');
$where_clause = $this->db->get_compiled_select();
//Create main query
$this->db->select('*');
->from('your_table');
->where("`kd_x` IN ($where_clause)", NULL, FALSE);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.