gpt4 book ai didi

javascript - 如何使用 ci jquery ajax 对连接表进行分组?

转载 作者:行者123 更新时间:2023-11-29 17:32:05 27 4
gpt4 key购买 nike

This is the code in my index to display the output please click here to view the image这是我在模型中的代码:请提前帮我修复该问题,谢谢。我想要的是加入下号。 5 看一下图片作为引用。

 public function showallcoddislist(){
$company_id = $this->input->get('company_id');
$location_id = $this->input->get('location_id');
$cod_id = $this->input->get('id');

$this->db->distinct('A.cod_disob_id');
$this->db->select('A.cod_disob_id,A.disob_title,B.disob,B.punish,B.num_days,B.offense,B.pun_id');
$this->db->order_by('A.cod_disob_id', 'asc');
$this->db->where(array(
'A.company_id' => $company_id,
'A.location_id' => $location_id,
'A.cod_id' => $cod_id
));
$this->db->join("cod_disob_punish B","B.cod_disob_id = A.cod_disob_id","left outer");

$query = $this->db->get('cod_disobedience A');

if($query->num_rows() > 0){
return $query->result();
}else{
return false;
}

}

最佳答案

public function showallcoddislist(){
$company_id = $this->input->get('company_id');
$location_id = $this->input->get('location_id');
$cod_id = $this->input->get('id');

$this->db->distinct('A.cod_disob_id');
$this->db->select('A.cod_disob_id,MAX(A.cod_disob_id) as cod_disob_id,A.disob_title,B.disob,B.punish,B.num_days,B.offense,B.pun_id');
$this->db->order_by('A.cod_disob_id', 'asc');
$this->db->where(array(
'A.company_id' => $company_id,
'A.location_id' => $location_id,
'A.cod_id' => $cod_id
));
$this->db->join("cod_disob_punish B","B.cod_disob_id = A.cod_disob_id","left outer");
$this->db->groupBy(['cod_disob_id'])
$query = $this->db->get('cod_disobedience A');

if($query->num_rows() > 0){
return $query->result();
}else{
return false;
}

}

关于javascript - 如何使用 ci jquery ajax 对连接表进行分组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50559645/

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