SELECT EnterDate, Desc,
DSum("Amount","GLTest","[Date] = EnterDate") AS SumThisDate,
DSum("Amount","GLTest","[Date] BETWEEN DateSerial(Year(EnterDate),Month(EnterDate),1) AND EnterDate") AS MTD
DSum("Amount","GLTest","[Date] BETWEEN DateSerial(Year(EnterDate),1,1) AND EnterDate") AS YTD
FROM GLTest;
SELECT a.EnterDate, a.Desc,
(SELECT Sum(b.Amount) FROM GLTest b WHERE b.Desc = a.Desc AND b.[Date] = a.EnterDate) AS SumThisDate,
(SELECT Sum(b.Amount) FROM GLTest c WHERE c.Desc = a.Desc AND c.[Date] BETWEEN DateSerial(Year(EnterDate),Month(EnterDate),1) AND EnterDate) AS MTD,
etc.
FROM GLTest a;
|