Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
hspatil31
Posting Yak Master
182 Posts |
Posted - 2009-09-02 : 01:02:10
|
| Dear All,I tried following queary. It is working fine.In that only T_BANK_IMPORT_BI table of field FLEXI_2 = 'M' updaeing.Now i want to update both table similarly means i want to update T_CD_IMPORT this table also.In both table FLEXI_2 this field is comman. Can anybody tell me how to join update following queary.Queary :UPDATE T_BANK_IMPORT_BISET FLEXI_2 = 'M' where PK_SCHEME_ID in(select x.PK_CH_SCHEME_ID from(SELECT sum(cast(Amount as decimal(18,2))) as CHANN_AMOUNT,PK_CH_SCHEME_ID FROM T_CD_IMPORT WHERE TRADE_DATE = '4/13/2009' AND cast(AMOUNT as decimal(18,2)) <>0 and flexi_2 IS NULL and BANK_CODE = 'HDFC CH-RELMON' group by PK_CH_SCHEME_IDintersect SELECT sum(cast(CREDITS as decimal(18,2))) as BANK_CREDIT,PK_SCHEME_ID FROM T_BANK_IMPORT_BI WHERE DATE = '4/13/2009' AND cast(CREDITS as decimal(18,2)) <>0 and flexi_2 IS NULL and BANK_CODE = 'HDFC CH'group by PK_SCHEME_ID)x) and DATE = '4/13/2009' thnks harish |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2009-09-02 : 04:59:49
|
| Then you would need a second update statement as you can only update one table at a time in a single update statement. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-09-02 : 05:06:25
|
| or you need to form a view out of two tables T_BANK_IMPORT_BI & T_CD_IMPORT and update through ithttp://weblogs.sqlteam.com/brettk/archive/2008/04/03/60560.aspx |
 |
|
|
|
|
|