0
活動記錄我有活動記錄笨第二版王氏特殊標準這樣一個問題:CONCAT病情左加入笨
$this->db->select('t_po_detail_item, t_process_shif, m_machine_lines, m_machine_mac, t_po_detail_no,
t_prod_lot, CONCAT(t_prod_lot, "-", t_prod_sublot) AS nolot,
COUNT(t_prod_sublot) AS qtybox, SUM(t_process_qty) AS qtypcs,
ROUND((SUM(t_process_qty)*m_process_weight)/1000,1) AS qtyberat', FALSE);
$this->db->join(self::$table2, 't_process_prod_id = t_prod_id', 'left')
->join(self::$table3, 't_prod_lot = t_po_detail_lot_no', 'left')
->join(self::$table5, 't_process_machine = m_machine_id', 'left')
->join(self::$table4, 'CONCAT_WS("-",t_po_detail_item, t_process_cat) = CONCAT_WS("-",m_process_id, m_process_proc_cat_id)', 'left');
$this->db->where('t_process_cat', 16);
$this->db->group_by('nolot');
$query = $this->db->get(self::$table1);
有有特殊的標準,加入與CONCAT WS條件。如果我使用標準查詢mysql,查詢運行正常。
$sql = 'SELECT t_po_detail_item, t_process_shif, m_machine_lines, m_machine_mac, t_po_detail_no, t_prod_lot, CONCAT_WS("-",t_prod_lot, t_prod_sublot) AS nolot,
COUNT(t_prod_sublot) AS qtybox, SUM(t_process_qty) AS qtypcs, ROUND((SUM(t_process_qty)*m_process_weight)/1000,1) AS qtyberat
FROM `t_process`
LEFT JOIN t_prod ON t_process_prod_id = t_prod_id
LEFT JOIN t_po_detail ON t_prod_lot = t_po_detail_lot_no
LEFT JOIN m_machine ON t_process_machine = m_machine_id
LEFT JOIN m_process ON CONCAT_WS("-",t_po_detail_item, t_process_cat) = CONCAT_WS("-",m_process_id, m_process_proc_cat_id)
WHERE t_process_cat=16
GROUP BY(nolot)';
$query = $this->db->query($sql);
我的活動記錄代碼有錯誤嗎? 關於,
Neos。
嘗試$這個 - > DB-> last_query();並在查詢 – Rijin
仍然錯誤..檢查差異位置此代碼? – NeoS