gpt4 book ai didi

mysql - 如何通过codeigniter中的同一列获取多行

转载 作者:行者123 更新时间:2023-11-29 17:13:44 25 4
gpt4 key购买 nike

我正在尝试通过同一列获取多行。我使用了having子句,按所有内容进行分组,但它仍然只返回一行。

   function slots($condition){
$this->db->select('slot_id');
$this->db->from('mn_date_slot');
$this->db->where('journey_date',$condition);
$this->db->group_by('journey_date');
$this->db->order_by('slot_id','desc');
return $this->db->get()->result_array();
}

i want to fetch slot_id from 4 rows where journey_date is same.

最佳答案

如果您想获取行程日期相同的所有记录,则需要删除分组依据选项。使用以下函数

function slots($condition){
$this->db->select('slot_id');
$this->db->from('mn_date_slot');
$this->db->where('journey_date',$condition);
$this->db->order_by('slot_id','desc');
return $this->db->get()->result_array();
}

关于mysql - 如何通过codeigniter中的同一列获取多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51751702/

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