出现这样的列标签错误,大多数都是未指明列对象所属表。 因此
INSERT INTO dvi_tr
selectdvi_tr_receive.sys_date,
dvi_tr_receive.item_cd,
dvi_tr_receive.vendor_id,
0 as sales_qty,
0 as sales_amt,
0 as gross_amt,
0 as cost_amt,
0 as order_qty,
0 as on_order_qty,
0 as order_no_receive_qty,
0 as receive_qty,
0 as return_qty,
0 as stock_qty,
0 as order_amt,
0 as on_order_amt,
0 as order_no_receive_amt,
0 as receive_amt,
0 as return_amt,
0 as stock_amt,
0 as sale_store_qty,
0 as receive_store_qty
from
dvi_tr_receive LEFT JOIN dvi_tr
ON dvi_tr_receive.sys_date = dvi_tr.sys_date AND
dvi_tr_receive.item_cd = dvi_tr.item_cd AND
dvi_tr_receive.vendor_id = dvi_tr.vendor_id
where
sys_date <= @sys_start_date and
sys_date >= @sys_end_date and
not EXISTS (SELECT 1 FROM dvi_tr_order WHERE dvi_tr_receive.sys_date = dvi_tr.sys_date and
dvi_tr_receive.item_cd = dvi_tr.item_cd and
dvi_tr_receive.vendor_id = dvi_tr.vendor_id);
修改方式:
加别名就好了 这是因为没有加别名引起的