SQL Updates with functions

How to code an SQL UPDATE on AS/400 with mathematical functions is explained by Kent Milligan.

I searched the entire TargetSearch but still couldn't find the SQL UPDATE with the addition function. May I know how to perform an SQL UPDATE with the following condition? EX: File1 with FieldA and File2 with FieldB...how to do the SQL UPDATE for FieldA in the equation below: FieldA=FieldA+FieldB?
The UPDATE would look be similar to the following statements depending on search conditions (if any)

UPDATE file1 SET FieldA=FieldA + (SELECT FieldB FROM file2)

UPDATE file1 SET FieldA=FieldA + (SELECT FieldB FROM file2 WHERE file2.keyfld = file1.keyfld)

This was last published in May 2008

Dig Deeper on iSeries SQL commands and statements

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: