0
我想使用group by,以便我可以获取数据为country-state-district
。我只想显示国家,然后州和地区级要添加复选框。查询 - 不正确答案
$this->db->distinct();
$this->db->select('country_name,s_name,dist_name');
$this->db->from('resource_details');
$this->db->join('location','reso_dtail_location=loc_id');
$this->db->join('go_state', 'go_stste_id = loc_state', 'left');
$this->db->join('go_country', 'num = loc_country', 'left');
$this->db->join('go_dist', 'id = loc_district', 'left');
$this->db->where('loc_id !=1 AND loc_id !=2');
$query = $this->db->get();
//result
$location = $query->result();
但查询不使用group_by
它仅显示第1记录
你想要做什么?不明白 – Vinie
我没有看到代码中的任何地方'group_by'? –
请用'echo $ this-> db-> last_query()'检查你的查询,你得到的错误/结果是什么以及你想要的结果是什么? –