我正在尝试通过同一列获取多行。我使用了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();
}
我想从trip_date相同的4行中获取slot_id。
答案 0 :(得分:0)
如果要获取旅程日期相同的所有记录,则需要按选项删除组。使用以下功能
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();
}