AllMememe
Technical User
- Feb 3, 2011
- 5
I need to get the name of each month that an expiry date exists and the number of expiry dates per month.
SELECT Format(LicenceExp,'mmm') as Month, count (*) as Occ
from Licence
group by Format(LicenceExp,'mmm')
order by Format(LicenceExp,'mmm') DESC
Results:
Dec 1
Jun 1
Oct 2
Jul 4
May 2
This gets the month name, the occurrence and groups by the month but does not order by month.
Is there anyway for all months to show, even if there is no expiry date for that month and just have 0 occurrences?
At the moment I am really only worried about ordering by date please! Anything else would be a bonus!
Thanks in advance!
SELECT Format(LicenceExp,'mmm') as Month, count (*) as Occ
from Licence
group by Format(LicenceExp,'mmm')
order by Format(LicenceExp,'mmm') DESC
Results:
Dec 1
Jun 1
Oct 2
Jul 4
May 2
This gets the month name, the occurrence and groups by the month but does not order by month.
Is there anyway for all months to show, even if there is no expiry date for that month and just have 0 occurrences?
At the moment I am really only worried about ordering by date please! Anything else would be a bonus!
Thanks in advance!