Good evening, all.  I hope I do not rile up Tore with this question!

I have a SQL Server 2000 DB that has a table with 2 columns: fooTime and
Value.  fooTime is a DateTime and populated using NOW().  This is
updated about every second, and the Value changes about .001 each
update, either up or down.

I want to get the average of Value from X minutes ago until now.  X will
change according to the whims of the user.

I have tried 

Select AVG(Value) 
FROM tblfoo
Where fooTime Between (minute, NOW - X) AND (minute,NOW)

But the results don't seem to be right.  If I calculate the average
manually, it does not match the query results.

What am I doing wrong?


TIA. (And none of the datetime info is stored or queried as a string,
Tore!)

Mark Rider


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to