Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update syntaxe for a stock programmation.
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01228160
Message ID:
01241268
Views:
21
To update one day
lnVp_Id = 2

UPDATE ap   ;
		SET nstkjour = pd.nStkjourCor - pd.nConsjourCor ;
	FROM V_AgendaPhar ap ;
	JOIN(;
			SELECT apd.nStkjour AS nStkjourCor, nConsjour AS nConsjourCor, ;
					apd.itraiterId , apd.iagendadat ;
				FROM  V_AgendaPhar apd ;
				WHERE apd.iagendadat < lnVp_Id ;
					AND NOT EXISTS ( SELECT * FROM  V_AgendaPhar  ;
						WHERE itraiterId = apd.itraiterId ;
							AND iagendadat < lnVp_Id ;
							AND iagendadat > apd.iagendadat)) pd ;
	ON ap.itraiterId = pd.itraiterId ;
	WHERE ap.iagendadat = lnVp_Id
>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
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform