【发布时间】:2023-03-10 04:02:01
【问题描述】:
这是我的模型
function report($where = '')
{
$this->db->select(array('o.id_order AS id_order', 'nama_pemesan', 'kota', 'total', 'SUM(biaya) AS do.biaya'));
$this->db->from('t_order o JOIN t_detail_order do ON (o.id_order = do.id_order)');
$this->db->where($where);
$this->db->group_by('o.id_order');
return $this->db->get();
}
这是我的桌子 t_order
这是我的桌子 t_detail_order
这是错误
这是我的控制器报告
公共函数报告() { $this->load->library('form_validation'); $this->cek_login();
if ($this->input->post('submit', TRUE) == 'Submit') { $this->form_validation->set_rules('bln', 'Bulan', 'required|numeric'); $this->form_validation->set_rules('thn', 'Tahun', 'required|numeric'); if ($this->form_validation->run() == TRUE) { $bln = $this->input->post('bln', TRUE); $thn = $this->input->post('thn', TRUE); } } else { $bln = date('m'); $thn = date('Y'); } //YYYY-mm-dd //2017-04-31 $awal = $thn.'-'.$bln.'-01'; $akhir = $thn.'-'.$bln.'-31'; $where = ['tgl_pesan >=' => $awal, 'tgl_pesan <=' => $akhir, 'status_proses' => 'proses', 'selesai']; $data['data'] = $this->trans->report($where); $data['bln'] = $bln; $data['thn'] = $thn; $this->template->admin('admin/laporan', $data); }
【问题讨论】:
-
不同。在我的问题中,只有 2 个表加入,但 3 个列相同
标签: codeigniter jointable