0 pts.
 AS/400 SQL V5R2 — updating new fields in a file with values from a different file
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

Software/Hardware used:
ASKED: March 31, 2005  10:15 AM
UPDATED: April 1, 2005  8:18 AM

Answer Wiki:
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).
Last Wiki Answer Submitted:  April 1, 2005  3:35 am  by  AlastairDK   0 pts.
All Answer Wiki Contributors:  AlastairDK   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

or more efficiently

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

 7,185 pts.