把因没有下载商品导致没有商品货号的订单明细,重新匹配货号,再次吐槽mysql的update和delete脚本限制多多,让我这不合格的程序员难堪
create table tmp201409162227 AS SELECT l.po_line_id, pt.product_code FROM trade t, po_header p, po_line l, product pt WHERE t.shop_id = 3456 AND t.pay_time >= ‘2014-09-16 00:00:00‘ AND t.pay_time <= ‘2014-09-16 23:59:59‘ AND t.Trade_ID = p.Trade_ID AND p.Po_Header_Id = l.po_header_id and l.num_iid = pt.num_iid AND (t.Trade_Status = ‘WAIT_BUYER_CONFIRM_GOODS‘ OR t.Trade_Status = ‘WAIT_SELLER_SEND_GOODS‘) AND l.product_code = ‘‘; UPDATE po_line lll SET lll.product_code = (SELECT tm.product_code FROM tmp201409162227 tm where tm.po_line_id = lll.po_line_id) WHERE lll.po_line_id IN (SELECT tt.po_line_id FROM tmp201409162227 tt );
原文:http://www.cnblogs.com/iaoc/p/3976022.html