I am trying to update one field on records in a database file, but only the database file records for which there is a matching record in a small upload file. The upload file contains one field, item number, and is a list of items to be deleted. The database file is our ERP system's Item Master. Thank goodness for test libraries!
Select * from TestLib/MasterFile inner join MyLib/DltList on MasterFile.itemno=DltList.itemno
The above SQL statement, when run on the iSeries successfully selects from MasterFile only the 200+ item records that are also in the upload file, DltList.
Sadly, when I try to add the update function...
UPDATE TestLib/MasterFile
SET RecID = 'IZ'
WHERE EXISTS (Select * from TestLib/MasterFile inner join MyLib/DltList on MasterFile.itemno=DltList.itemno)
...I end up updating all records in the master file. Clearly, I'm misunderstanding something. What am I missing?
TIA,
Lucy
Select * from TestLib/MasterFile inner join MyLib/DltList on MasterFile.itemno=DltList.itemno
The above SQL statement, when run on the iSeries successfully selects from MasterFile only the 200+ item records that are also in the upload file, DltList.
Sadly, when I try to add the update function...
UPDATE TestLib/MasterFile
SET RecID = 'IZ'
WHERE EXISTS (Select * from TestLib/MasterFile inner join MyLib/DltList on MasterFile.itemno=DltList.itemno)
...I end up updating all records in the master file. Clearly, I'm misunderstanding something. What am I missing?
TIA,
Lucy
Comment