• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1486
  • Last Modified:

AS400 SQL update with multiple files

I would like to update fields on one file based on a join between it and an another file.  I keep getting error on my varies attempt.  (from not expected)

One example:

update cempmst set emp1='000000',amt=0  
from cempmst a, cnewemp b              
where  nwcemp=emp                      


Thank You.  
                         


0
lynn_harris
Asked:
lynn_harris
1 Solution
 
Gary PattersonVP Technology / Senior Consultant Commented:
FROM clause is not allowed on an UPDATE.  Can you explain what you are trying to do?  Looks like you want to zero out the emp1 and amt fields for all employees in the "new employee" table.  If so:

update cempmst
set emp1='000000', amt=0
where emp in (select nwcemp from cnewemp)

- Gary Patterson
0
 
lynn_harrisAuthor Commented:
You were correct  It work perfectly.  

Thanks again.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now