AS/400 SQL V5R2 — updating new fields in a file with values from a different file

pts.
Tags:
SQL
I added 2 fields to FileA (FldX and FldY) FileA has the key to FileB (KeyB) where these values exist. FileA: FldA, FldB, KeyB, new... FldX, FldY FileB: BKeyB, BFldX, BFldY This is probably simple for someone that composes SQL all the time but I'm having trouble coming up with acceptable syntax... Thanks for any help you can provide... Dave

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi Dave,

You need something like this:

Update FileA set FldX=(select BFldX from FileB where KeyB=BKeyB) , FldY=(select BFldY from FileB where KeyB=BKeyB).

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

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
  • BigKat
    or more efficiently Update FileA A set (FldX, FldY)= (select BFldX, BFldY from FileB where BKeyB = A.KeyB)
    8,010 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

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

Thanks! We'll email you when relevant content is added and updated.

Following