Ask the Expert

SQL Updates with functions

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 first published in May 2008

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

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: