我正在使用 codeigniter 創建一個項目,所有模塊在本地主機中都工作正常,但是當我在 AWS 上上傳文件時,它顯示錯誤,主要是不起作用,如果我刪除group_by()此功能,它工作正常,請幫助,我添加了一些代碼片段和表結構。模型: public function getPendingPayments() { $this->db->where('is_paid', 0); $this->db->where('is_installment', 0); $this->db->group_by('party'); // here if I remove this line, everything works fine $this->db->order_by('bill_date', 'asc'); return $this->db->get('bills')->result();}控制器:$data['UNPAID_CLIENTS'] = $this->Payments_model->getPendingPayments();表結構:錯誤:
2 回答

FFIVE
TA貢獻1797條經驗 獲得超6個贊
試試這個
public function getPendingPayments() {
$this->db->where('is_paid', 0);
$this->db->where('is_installment', 0);
$this->db->group_by('party');
$this->db->order_by('bill_date', 'asc');
if($this->db->num_rows() < 1){
return false;
}else{
return $this->db->get('bills')->result();
return $this->db->get('bills')->result();
}

慕婉清6462132
TA貢獻1804條經驗 獲得超2個贊
經過調查,我發現手動執行查詢時mysql出現錯誤。
所以我only_full_group_by
通過在 SQL Server 中執行這一行來全局刪除
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
- 2 回答
- 0 關注
- 118 瀏覽
添加回答
舉報
0/150
提交
取消