Count at Quarterly

FlyGuyTray

Registered User.
Local time
Yesterday, 22:00
Joined
Nov 30, 2010
Messages
38
I would like to query my table and display results by quarters. # of items received for the 1st, 2nd, 3rd, and 4th quarters of the year.. I do not know how to do this unfortunately.. :(
 
You can use the datepart() function to get the quarter in which a date occurs. You will also have to take into account the year.

The query may look something like this:


SELECT year(yourdate) as PeriodYear, datepart("q", yourdate) as PeriodQuarter, Count(somefield) as MyCount
FROM yourtable
GROUP BY year(yourdate), datepart("q", yourdate)
 

Users who are viewing this thread

Back
Top Bottom