Another solution occurred to me, which may well be faster, if you are happy
to use the TOP option:
SELECT P1.UserName, P1.PostDate, P1.Amount,
P1.Amount -
(SELECT TOP 1 Amount
FROM tblPosted AS P2
WHERE P2.UserName = P1.UserName
AND P2.PostDate P1.PostDate
ORDER BY PostDate DESC)
AS Variance
FROM tblPosted AS P1
ORDER BY P1.UserName, P1.PostDate;
Ken Sheridan
Stafford, England
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200912/1