-1
Ich habe dieses Modell zuvor verwendet und es funktioniert, und jetzt weiß ich nicht, warum $ this-> db-> distinct(); funktioniert nicht.So verwenden Sie distinct im Codeigniter
if($this->input->post('Status'))
{
$this->db->where('Status', $this->input->post('Status'));
}
if($this->input->post('PlateNo'))
{
$this->db->like('PlateNo', $this->input->post('PlateNo'));
}
if($this->input->post('user.userId'))
{
$this->db->like('user.userId', $this->input->post('user.userId'));
}
$this->db->select('*');
$this->db->distinct();
$this->db->from($this->table);
$this->db->join('user', 'user.userId = loanapplication.userId', 'left');
$this->db->join('loanrequest', 'loanrequest.ApplicationNo = loanapplication.ApplicationNo', 'left');
$this->db->join('loanapproval', 'loanapproval.RequestNo = loanrequest.RequestNo', 'left');
$this->db->join('collateraldetails', 'collateraldetails.ApplicationNo = loanapplication.ApplicationNo', 'left');
$this->db->join('paymentdetails', 'paymentdetails.ApplicationNo = loanapplication.ApplicationNo', 'left');
$this->db->join('loanpayment', 'loanpayment.PaymentId = paymentdetails.PaymentId', 'left');
$this->db->join('vehicleinformation', 'vehicleinformation.vehicleNo = collateraldetails.vehicleNo', 'left');
Dank für Ihre Antwort. –
Wann verwenden Sie group_by oder distinct? Was ist der Unterschied? –
Mit 'GROUP BY' können Sie Aggregatfunktionen wie' AVG', 'MAX',' MIN', 'SUM' und' COUNT' verwenden. Andere Hand 'DISTINCT' entfernt nur Duplikate. Weitere Informationen finden Sie unter https://stackoverflow.com/questions/164319/is-there-any-difference-between-group-by-and-distinct –