koncuk 0 Newbie Poster

Hi,

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 @BeginDate ='01.01.2010'
SELECT @BeginEnvanter = Sum(Count) FROM StokMove
WHERE Stok=@Stok
ELSE
SELECT @BeginEnvanter = @EndEnvanter WHERE Day(@BeginDate-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?
Thanks,