Get started Bring yourself up to speed with our introductory content.

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)

Dig Deeper on iSeries SQL commands and statements

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.