SELECT a.*,e.* FROM `hierarchy_users` AS a
INNER JOIN `enquiry` As e
ON (e.hierarchy_users_id=a.id AND e.`enquiry_date`='2018-02-2')
WHERE `created_by`='31'
答案 0 :(得分:1)
试试这个
$this->db->select('a.*,e.*');
$this->db->from('hierarchy_users a');
$this->db->join('enquiry e','e.hierarchy_users_id=a.id');
$this->db->where('e.enquiry_date=2018-02-02');
$result_set = $this->db->get();
if($result_set->num_rows() > 0){
return $result_set->result();
}