|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Update multi-values
Hi,
I'm trying to update a table's column. the values are taken from a join with 3 table. this join return to me 4 diferent values. I would like put this 4 values in my target table's column. It's possible? following there is my code: UPDATE DBFN01.CLIENT_BD_TOTAL AS TC SET TC.PERCCOERNOTCOER = ( SELECT (PERCENTAGE-T.PERCTOTASSETCLASS) PERCCOERNOTCOER FROM DBFN01.CLIENT_BD_TOTAL T LEFT OUTER JOIN( SELECT * FROM DBFN01.CLIENT_BD_TOTAL T , DBFN01.RPFPFMMULBANKID RPF, DBFN01.PFMASSCLASSBDENTRY P WHERE RPF.PROFILEID=T.RISKPROFILEID AND RULEID=1 AND RPF.PTFID=P.PTFID AND T.ASSETCLASSID=P.ID) TEST ON (T.EXTERNALID=TEST.EXTERNALID) WHERE T.ACLEVEL =2 AND T.EXTERNALID = '001994275_REF' ) thk |
|
#2
|
|||
|
|||
|
Quote:
If you can fit both your feet and both your hands into one shoe, It might be possible. |
|
#3
|
|||
|
|||
|
Quote:
Normally you would do your select of the three tables first, save off the values you want, and then proceed with a separate update. Take a look at the DB2 Cookbook(s): http://mysite.verizon.net/Graeme_Birchall/id1.html It may be possible to do your update, but you might want to do a nested table join on the latter part. What result do you get when you execute the SQL you posted? fv
__________________
...because that is the way we have always done it. We've been doing it like that for 80 Years! (How do we change that mindset?) |
|
#4
|
|||
|
|||
|
in my previews query my resultset was a record of 4 values, but now change my idea.. the concept is select a range of values and put them in my target table column using a 'where' condition to match the values.
this is my new query, but the sysntax is not correct for bd2 UPDATE DBFN01.CLIENT_BD_TOTAL AS TC, (SELECT (PERCENTAGE-T.PERCTOTASSETCLASS) AS PERCCOERNOTCOER,T.EXTERNALID,T.INSTITUTIONID,T.ASSETCLASSID,T.ACLEVEL FROM DBFN01.CLIENT_BD_TOTAL T LEFT OUTER JOIN( SELECT * FROM DBFN01.CLIENT_BD_TOTAL T ,DBFN01.RPFPFMMULBANKID RPF,DBFN01.PFMASSCLASSBDENTRY P WHERE RPF.PROFILEID=T.RISKPROFILEID AND RULEID=1 AND RPF.PTFID=P.PTFID AND T.ASSETCLASSID=P.ID) TEST ON (T.EXTERNALID=TEST.EXTERNALID AND T.INSTITUTIONID = TEST.INSTITUTIONID ) ) AS TC2 SET TC.PERCCOERNOTCOER = TC2.PERCCOERNOTCOER WHERE T.ACLEVEL =2 AND TC.EXTERNALID = TC2.EXTERNALID AND TC.INSTITUTIONID = TC2.INSTITUTIONID AND TC.ASSETCLASSID = TC2.ASSETCLASSID AND T.EXTERNALID = '001994275_REF' any idea. cheers d |
![]() |
| Viewing: Dev Shed Forums > Databases > DB2 Development > Update multi-values |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|