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
ASKED: Mar 31, 2005  10:15 AM GMT
UPDATED: April 1, 2005  8:18:08 AM GMT
0 pts.

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:  Apr 1, 2005  3:35 AM (GMT)  by  AlastairDK   0 pts.
To see other 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)

 5,535 pts.