ImI'm trying to calccalculate the average, between a specific date/time, of the difference between the current field and the previous field. At present iveI've got a query which displays this but imI'm unsure how iI can now filter this such that iI can get the average of the 'Diff' column between a specific date/time. (Apologies in advance for my sql skill, or lack offof.)
SELECT
S.Pair,
S.Date,
S.Time,
S.Bid,
S.Time,
ABS(S.Bid - T.Bid) as 'Diff'
FROM
dbo.Data as S
CROSS APPLY
(
SELECT TOP 1 T.Bid
FROM
dbo.Data as T
WHERE
T.Id > S.Id
) as T
Any pointers would be appreciated.
EDIT: