我有 2 张桌子,Table A
有Order No
, Order Line
, receiving no
, receiving date
, receiving qty
。
Order Order Line Receiving No Receiving Date Receiving Qty
A 1 455555 12/01/2013 10
A 1 455556 12/01/2013 15
A 1 455557 15/01/2013 7
A 1 455558 16/01/2013 10
A 1 455559 16/01/2013 10
A 1 455560 16/01/2013 15
A 1 455561 31/01/2013 7
Table B
有Order No
, Order Line
, Invoice no
, Invoice Qty
, Invoice Date
.
Order Order Line Invoice no Invoice Date Invoice Qty
A 1 333331 13/01/2013 32
A 1 333332 15/01/2013 10
A 1 333333 01/02/2013 32
如何创建存储过程来更新Invoice No
,Invoice Qty
和Invoice Date
from ?Table B
Table A
我对存储过程很陌生,任何帮助将不胜感激。
期望的输出:
Order Order Line Receiving No Receiving Date Receiving Qty Invoice No Invoice Date Invoice Qty
A 1 455555 12/01/2013 10 333331 13/01/2013 10
A 1 455556 12/01/2013 15 333331 13/01/2013 15
A 1 455557 15/01/2013 7 333331 13/01/2013 7
A 1 455558 16/01/2013 10 333332 15/01/2013 10
A 1 455559 16/01/2013 10 333333 01/02/2013 10
A 1 455560 16/01/2013 15 333333 01/02/2013 15
A 1 455561 31/01/2013 7 333333 01/02/2013 7