时间:2021-07-01 10:21:17 帮助过:26人阅读
** 請教各位高手:
我在VBA中如下連接mysql單表查詢沒問題,有數據出來。
**
.CommandText = Array( _
"select " _
& "proc_hist_0.prod_pn , proc_hist_0.LOT_NO, proc_hist_0.proc_ID, proc_hist_0.IN_TIME, proc_hist_0.IN_QTY, proc_hist_0.OUT_TIME, proc_hist_0.OUT_QTY " _
& "FROM proc_hist proc_hist_0 " _
& "WHERE " _
& "proc_hist_0.co_code='" & mrpc & "' and proc_hist_0.PROD_PN='" & itnr & "' ")
**但是增加一個表左連接后就不行,報錯:執行階段錯誤'13' 型態不符合 。
**
如下代碼,請幫忙看看錯在哪裡:
.CommandText = Array( _ "select " _ & "proc_hist_0.prod_pn , proc_hist_0.LOT_NO, proc_hist_0.proc_ID, proc_hist_0.IN_TIME, proc_hist_0.IN_QTY, proc_hist_0.OUT_TIME, proc_hist_0.OUT_QTY " _ & "FROM proc_hist proc_hist_0 " _ & "Left Join " _ & "proc_para proc_para_0 " _ & "On " _ & "proc_hist_0.co_code = proc_para_0.co_code " _ & "and " _ & "proc_hist_0.wip_id = proc_para_0.wip_id " _ & "and " _ & "proc_hist_0.proc_ref = proc_para_0.proc_ref " _ & "WHERE " _ & "proc_hist_0.co_code='" & mrpc & "' and proc_hist_0.PROD_PN='" & itnr & "' ")