1
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.
4

1 に答える 1

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 
于 2013-06-10T05:36:40.470 に答える