gpt4 book ai didi

php - Codeigniter 不同查询不起作用

转载 作者:行者123 更新时间:2023-11-29 21:52:24 25 4
gpt4 key购买 nike

我有一个数据库查询来选择不同的类别。但是,我有 2 个连接表,我的不同查询不起作用,因为它返回重复的类别。我需要进行哪些代码调整?这是我的查询代码。

 $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();

关于php - Codeigniter 不同查询不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33501094/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com