That would be a bingo Jochem, thank you very much. Dan =================== Previous Message Below ===================
-----Original Message----- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Sunday, August 24, 2003 10:10 AM To: CF-Talk Subject: Re: OT: SQL aggregate question Dan O'Keefe wrote: > > This query: > ----------- > select ptssn, sum(arbalancedue) as sumar > from ga_temp > group by ptssn > having sum(arbalancedue) < 50 > > Yields these results: > --------------------- > Ptssn sumAr > 237451046 26.4800 > 255785250 25.2000 > 267582694 42.3200 > 294629611 42.3200 > > But what I really want is 1 query to return to me a count of 4 with a > total of 136.32 SELECT COUNT(ptssn) AS ptssn, SUM(sumAr) AS sumAr FROM ( SELECT ptssn, SUM(arbalancedue) AS sumAr FROM ga_temp GROUP BY ptssn HAVING SUM(arbalancedue) < 50 ) a Jochem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm

