Using the table I and the date_entered fields and the code, I wrote a query to list the bill for each year, where code = '12A'.
select distinct year(date_entered) as Yr, count(*) as Cnt from i where code = '12A' group by year(date_entered) order by Yr desc
This gives:
Yr | Cnt 2011 | 780 2010 | 3489 2009 | 3256 ...
I want to include the sum of the Cnt variable in my result set. I know how to find the amount using a separate request, but I would like to calculate the amount in my original request.
source share