updation from diffrent users [message #221123] |
Sat, 24 February 2007 01:15 |
amit_vass2000
Messages: 52 Registered: December 2006 Location: Delhi
|
Member |
|
|
hello everybody,
Good Morning
i m facing a big problem. i have to update a field which is related to 2 tables in two different users.
user 1--- ADDB (table - ad_rcpthdr)
user2--- ACC ( table - vch_mst)
field to be updated --- chno
i m giving u the overview of query
update vch_mst set chno=( addb.ad_rcpthdr.chno) where doctyp='RBR' and id in (select voucherno from addb.ad_rcpthdr where doctyp='RBR')
i want to update cheque no for each id. i think it will be clear to you. if not then plz ask me.
thanks in advance
|
|
|
Re: updation from diffrent users [message #221130 is a reply to message #221123] |
Sat, 24 February 2007 03:22 |
flyboy
Messages: 1903 Registered: November 2006
|
Senior Member |
|
|
Hello,
not sure what you mean. In the query you are trying to set the column CHNO in ACC.VCH_MST by the value of column CHNO in ADDB.AD_RCPTHDR. The tables seem to be joined on ACC.ID = ADDB.VOUCHERNO (and ACC.DOCTYP = ADDB.DOCTYP?). Not sure what you mean by the DOCTYP = 'RBR' and how it fits with Quote: | i want to update cheque no for each id
| what I would understand as you want to update all rows in ACC.
You can update only rows with DOCNUM = 'RBR', the way I described above (ran under ACC user, having select grant to ADDB.AD_RCPTHDR) with:
update VCH_MST dest
set dest.CHNO = (select src.CHNO
from ADDB.AD_RCPTHDR src
where dest.ID = src.VOUCHERNO and dest.DOCTYP=src.DOCTYP)
where dest.DOCTYP = 'RBR';
Adjust it to your requirement.
|
|
|
|