Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SubQuery Totaling Specific Subset of Records

0 views
Skip to first unread message

dallin

unread,
Dec 2, 2009, 3:15:01 PM12/2/09
to
Can someone give me some hints on how to write a query that does the
following -- I'm having a hard time subtotaling by period end date any sale
date record that is 60 days less than the period end date.

Co PED Sale date TaxCredit
1 12/31/08 10/31/08 15.00
1 12/31/08 10/31/08 12.00
1 12/31/08 09/30/08 5.00
9 01/31/09 11/30/08 10.15
9 01/31/09 11/30/08 21.15
9 01/31/09 09/30/08 10.02

Query Result should look like:
Co PED SaleDate TaxCredit
1 12/31/08 10/31/08 27.00
9 01/31/09 11/30/08 31.30

Alex Dybenko

unread,
Dec 3, 2009, 10:32:34 AM12/3/09
to
Hi,
try this:

SELECT Co, PED, [Sale date], Sum(TaxCredit)
FROM MyTable
GROUP BY Co, PED, [Sale date]

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"dallin" <dal...@discussions.microsoft.com> wrote in message
news:602A58D0-CAC2-469F...@microsoft.com...

0 new messages