Unanswered: Day before the date parameters entered
MS SQL 2005 I'm trying to write a stored procedure.Weighted average cost related to accounting.An area where the data from one field if the date is 01.01. There is no problem. But history is different from 01/01 with the calculated formula into another value equal to the previous day.If you want Let me demonstrate:
IF @BasTarih ='01.01.2010'
SELECT @BasEnvanter = Sum(Tutar) FROM StokHareket WHERE Stok=@Stok
SELECT @BasEnvanter = @BitEnvanter WHERE Day(@BasTarih-1)
Here, the amount collected in the first line I was on the date 01/01. But the day before the field is not BitEnvanter that bring value as I was. But here a formula that BitEnvanter area. That is not the first time BitEnvanteri calculated 01.01 and then got BasEnvantere synchronization.I think this, but let me run. I make a mistake in formulas or algorithms, I wonder do wrong?