我正在使用postgresql。两个表都有备注列。当我运行这个时,我得到一个错误,指出未找到列inv。
UPDATE inventory SET INV.REMARKS = INV.REMARKS || ', $A'
FROM priceguide_inventory pg, inventory INV
WHERE (INV.Lot_ID = pg.Lot_ID)
AND INV.Condition = 'New'
答案 0 :(得分:1)
您的语法已关闭,请尝试此操作:
UPDATE inventory AS inv
SET REMARKS = REMARKS || ', $A'
FROM priceguide_inventory AS pg
WHERE inv.Lot_ID = pg.Lot_ID AND
inv.Condition = 'New'
检查更新加入synatax的documentation。
答案 1 :(得分:0)
UPDATE inventory
SET REMARKS = REMARKS || ', $A'
FROM priceguide_inventory pg
WHERE inventory.Lot_ID = priceguide_inventory.Lot_ID AND
inventory.Condition = 'New'
答案 2 :(得分:0)
UPDATE a SET Remarks=b.Remarks || ',$A' FROM inventory a JOIN priceguide_inventory b ON a.Lot_ID = b.Lot_ID WHERE a.condition='New'