Posted on 2012-08-16
The following query gives me what I want - invoices which have a non-zero balance as of a certain date.
,sum([EPCUAM]) as Balance
WHERE EPACDT <201200816
GROUP BY EPCONO, EPDIVI, EPSPYN, EPSUNO, EPSINO, EPINYR
When I include this as a subquery in a query in order to get the detail records making up these sums, I get all records, not just those associated with the selected non-zero balance invoices.