Ok sergey ( sorry for my poor english ).
I would like to know a number (Stock) over day.
The 01/07/2007 a patient has one limps of drug eg (ASPRO 500) .
There are 50 compressed in a drug.
He consumes 1 compressed per day.
The stock , this day is 50 - 1 = 49
The 02/07/2007 it thus has 49 - 1 (consumption) = 48 (the stock of the previous day) - 1
The 03/07/2007 it thus has 48 - 1 = 47 (the stock of the previous day) - 1 = 47
OK ?
bernhart
>Sorry but I do not understand what you're trying to do.
>
>>
>
>>UPDATE V_AgendaPhar ;
>> SET nstkjour = NVL( pd.nStkjourCor , 0 ) ;
>> FROM V_AgendaPhar ;
>> LEFT JOIN(;
>> SELECT apd.nstkjour AS nStkjourCor , apd.itraiterId , apd.iagendadateid;
>> FROM AgendaPhar apd ;
>> WHERE apd.iagendadateid < THISFORM.Vp_Id ;
>> AND NOT EXISTS ( SELECT * FROM V_AgendaPhar ;
>> WHERE itraiterId = apd.itraiterId ;
>> AND V_AgendaPhar.iagendadateid < THISFORM.Vp_Id ;
>> AND V_AgendaPhar.iagendadateid > apd.iagendadateid)) pd ;
>> ON V_AgendaPhar.itraiterId = pd.itraiterId
>>
>>
>>
>>THISFORM.Vp_Id = 12
>> V_AgendaPhar is a view with Table Buffer
>>( Same structure that tempa.dbf )
>>
>>
>>
>>
>>
>>>Can you post the code ?
>>>
>>>>
>>>>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.htm>>>>
>>>>I 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.
>>>>