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)

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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.