我知道如何加入这两张表(发票和应付款)。应付款管理系统有balancedue
列,我需要将其与Invoices.originalamount
相同。
我写的是:
update payables p
set p.balancedue= i.originalamount
From payables p
join invoices i on p.id=i.id
where nationalaccountcode='xxx'
但是我收到了一个错误。有帮助吗? SSMS 2012,如果有帮助的话。
答案 0 :(得分:1)
试试这个......
UPDATE Payables
SET balancedue = i.originalamount
FROM invoices i
WHERE nationalaccountcode='xxx' AND Payables.id = i.id