If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Update with Inner Join in DB2 for AS400

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-20-07, 13:15
EMoscosoCam EMoscosoCam is offline
Registered User
 
Join Date: Mar 2003
Posts: 144
Question Update with Inner Join in DB2 for AS400

Hello

The following sentence does not run, is there an alternative way to achieve and Update using an Inner Join?

Thanks a lot.

update ECFORCLI.FCSTAAAA
set
FCU01A = ECFORCLI.FCSTAAAATM.FCU01A
from ECFORCLI.FCSTAAAA
inner join ECFORCLI.FCSTAAAATM on
ECFORCLI.FCSTAAAATM.FCANO = ECFORCLI.FCSTAAAA.FCANO and
ECFORCLI.FCSTAAAATM.FCSTOC = ECFORCLI.FCSTAAAA.FCSTOC
Reply With Quote
  #2 (permalink)  
Old 06-22-07, 08:48
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Hi,

update ECFORCLI.FCSTAAAA
set
FCU01A = ECFORCLI.FCSTAAAATM.FCU01A
from ECFORCLI.FCSTAAAA AS T1
where
(ECFORCLI.FCSTAAAATM.FCANO, ECFORCLI.FCSTAAAATM.FCSTOC)
in
(
select ECFORCLI.FCSTAAAA.FCSTOC, ECFORCLI.FCSTAAAA.FCANO from ECFORCLI.FCSTAAAA where
T1.FCANO = ECFORCLI.FCSTAAAA.FCANO and
T1.FCSTOC = ECFORCLI.FCSTAAAA.FCSTOC
)

I hope I didn't mistype table names. Please in the future use more simple names for example on forum.

Hope this helps,
Grofaty
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On