UPDATE PHYS_COUNT_TAG
SET COUNT_QTY = (
SELECT qty
FROM MC_PART_LOCATION
WHERE MC_PART_LOCATION.part_id = PHYS_COUNT_TAG.PART_ID
AND MC_PART_LOCATION.location_id = PHYS_COUNT_TAG.LOCATION_ID
)
上述代码不起作用。执行时我收到错误:
Msg 4104, Level 16, State 1, Line 4
The multi-part identifier "PCT.PART_ID" could not be bound.
Msg 4104, Level 16, State 1, Line 5
The multi-part identifier "PCT.LOCATION_ID" could not be bound.
答案 0 :(得分:3)
试试这个(T-SQL
) -
UPDATE p
SET COUNT_QTY = l.qty
FROM PHYS_COUNT_TAG p
JOIN MC_PART_LOCATION l ON l.part_id = p.PART_ID
AND l.location_id = p.LOCATION_ID