T
TonyWilliams via AccessMonster.com
I have a query that counts the number of records where the criteria has
defined values. This produces a list of the number of records for each month
based on a field txtmonth . Here is the sql and the results.
SELECT tblhvdealspt1.txtpurpose, Count(tblhvdealspt1.ID) AS CountOfID,
tblhvdealspt1.txtmonth
FROM tblhvdealspt1
WHERE (((tblhvdealspt1.txtpurpose)="Buyout" Or (tblhvdealspt1.txtpurpose)
="Refinancing" Or (tblhvdealspt1.txtpurpose)="Corporate Finance" Or
(tblhvdealspt1.txtpurpose)="Restructuring"))
GROUP BY tblhvdealspt1.txtpurpose, tblhvdealspt1.txtmonth;
Purpose CountOfID Month
Buyout 3 June 2009
Buyout 3 December 2009
Corporate Finance 10 June 2009
Corporate Finance 1 December 2009
Refinancing 12 June 2009
Refinancing 2 December 2009
Refinancing 1 January 2010
Restructuring 1 June 2009
What I now want to do is develop this SQL to give me totals for the year so
that the result would be this:
Purpose CountOfID CountOfID
2009 2010
Buyout 6 0
Corporate Finance 11 0
Refinancing 14 0
Refinancing 1 1
Restructuring 1 0
I will then need to produce a form where the user can select which year they
want to report on.
Can anyone help point me in the right direction?
Thanks
Tony
defined values. This produces a list of the number of records for each month
based on a field txtmonth . Here is the sql and the results.
SELECT tblhvdealspt1.txtpurpose, Count(tblhvdealspt1.ID) AS CountOfID,
tblhvdealspt1.txtmonth
FROM tblhvdealspt1
WHERE (((tblhvdealspt1.txtpurpose)="Buyout" Or (tblhvdealspt1.txtpurpose)
="Refinancing" Or (tblhvdealspt1.txtpurpose)="Corporate Finance" Or
(tblhvdealspt1.txtpurpose)="Restructuring"))
GROUP BY tblhvdealspt1.txtpurpose, tblhvdealspt1.txtmonth;
Purpose CountOfID Month
Buyout 3 June 2009
Buyout 3 December 2009
Corporate Finance 10 June 2009
Corporate Finance 1 December 2009
Refinancing 12 June 2009
Refinancing 2 December 2009
Refinancing 1 January 2010
Restructuring 1 June 2009
What I now want to do is develop this SQL to give me totals for the year so
that the result would be this:
Purpose CountOfID CountOfID
2009 2010
Buyout 6 0
Corporate Finance 11 0
Refinancing 14 0
Refinancing 1 1
Restructuring 1 0
I will then need to produce a form where the user can select which year they
want to report on.
Can anyone help point me in the right direction?
Thanks
Tony