Php Codeigniter独特查询不工作

Php Codeigniter独特查询不工作,php,mysql,codeigniter,Php,Mysql,Codeigniter,我有一个数据库查询来选择不同的类别。但是,我有两个连接的表,我的独特查询不起作用,因为它返回重复的类别。我必须进行什么代码调整?这是我的查询代码 $query = $this->db->distinct() ->select('tbl_par.*, tbl_category.category_name') ->or_like($array_like_param)

我有一个数据库查询来选择不同的类别。但是,我有两个连接的表,我的独特查询不起作用,因为它返回重复的类别。我必须进行什么代码调整?这是我的查询代码

 $query = $this->db->distinct()
                    ->select('tbl_par.*, tbl_category.category_name')
                    ->or_like($array_like_param)
                    ->from($this->table_par)
                    ->join($this->table_cat,$this->table_cat.'.ID ='.$this->table_par.'.category')
                    ->get();
试试这个

$this->db->select('tbl_par.*, distinct tbl_category.category_name');
$this->db->or_like($array_like_param)
$this->db->from($this->table_par)
$this->db->join($this->table_cat,$this->table_cat.'.ID ='.$this->table_par.'.category')
$query=$this->db->get();