Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Group By month or date range
Wed, Oct 12 2011 4:33 AMPermanent Link

IQA

Hi,

I'm looking for the most efficient way to group by a month or a week or a year. Maybe if I can work out the best way to say group by a month I can work out the others.

The field I will be grouping by is a timestamp.

Any ideas?

Thanks,

Phil.
Wed, Oct 12 2011 5:15 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Philip


select _HideAlarm, EXTRACT(MONTH FROM _HideAlarm) from calls
group by EXTRACT(MONTH FROM _HideAlarm)

Roy Lambert [Team Elevate]
Wed, Oct 12 2011 5:30 AMPermanent Link

IQA

Roy, you da man!

Thanks muchly!

Phil.
Wed, Oct 12 2011 5:38 AMPermanent Link

Ian Branch

Avatar

Roy Lambert wrote:

> select _HideAlarm, EXTRACT(MONTH FROM _HideAlarm) from calls
> group by EXTRACT(MONTH FROM _HideAlarm)

For readability, could you not do..

select _HideAlarm, EXTRACT(MONTH FROM _HideAlarm) as _Month from calls
group by _Month

Ian
Wed, Oct 12 2011 6:05 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


Having just tried it - yes

Roy Lambert
Wed, Oct 12 2011 7:24 AMPermanent Link

IQA

Brilliant, thanks Roy and Ian !
Image