Hi Sergey,
I have still a problem sergey.
Here is a sample table and a picture
Tempa.dbf
http://cjoint.com/data/hrsUUf1jES.htm UT4 picture
http://cjoint.com/data/hrsQZe7Byw.htmI want change nstkjour ( For the same itraiterId ) for igendadateid = 12 with the Value
of nstkjour - nconsjour For iagendadateid < 12.
Here im my picture = 49 - 1 = 48 But my code do'nt function any more.
Please Sergey help me.
Thank
bernhart
I have
>You have to use LEFT JOIN in order to upadte all records in the v_AgendaPhar. With INNER JOIN the records in v_AgendaPhar that don't have matching records in derived table pd will not be updated.
>
> UPDATE v_AgendaPhar ;
> SET nstkjour = NVL( pd.nStkjourCor , 0 ) +1 ;
> FROM v_AgendaPhar;
> LEFT JOIN(;
> SELECT apd.nstkjour AS nStkjourCor , apd.itraiterId ;
> FROM AgendaPhar apd ;
> WHERE apd.iagendadateid < vp_id ) pd ;
> ON v_AgendaPhar.itraiterId = pd.itraiterId
>
>
>
>>
>>I have many problems to know the stock of previous days.
>>I want for the day ( iagendadateid = 2 ) the stock of ( iagendadateid = 1 ) + 1
>>
><snip>