我有这样的SQL查询
SELECT *
FROM adm_species t
JOIN adm_breeds e ON e.species_id = t.id
JOIN fd_registrations s ON s.breeds_id = e.id
WHERE t.code = 'cat'
AND s.sex_id = '2'
AND s.ownername LIKE '%sha%'
如何转换这笨活动记录?
提前致谢!
我有这样的SQL查询
SELECT *
FROM adm_species t
JOIN adm_breeds e ON e.species_id = t.id
JOIN fd_registrations s ON s.breeds_id = e.id
WHERE t.code = 'cat'
AND s.sex_id = '2'
AND s.ownername LIKE '%sha%'
如何转换这笨活动记录?
提前致谢!
尝试这个
$this->db->select('*');
$this->db->from('adm_species t');
$this->db->join('adm_breeds e', 'e.species_id = t.id');
$this->db->join('fd_registrations s', 's.breeds_id = e.id');
$this->db->where('t.code', 'cat');
$this->db->where('s.sex_id', 2);
$this->db->like('s.ownername', 'sha', 'both');
$query = $this->db->get();