Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 537 Bytes

how_to_group_by_month_in_a_year.md

File metadata and controls

16 lines (11 loc) · 537 Bytes

How to group by month in a year

Sometimes you are requested to give a swift overview or statistic of how something evolves (or devolves) over time.

This query uses Oracle specific syntax, but this overall structure should be applicable in other SQL dialects.

select to_char(DATE_CREATED, 'YYYY-MM'), sum(something_we_can_count_on)
from our_table
group by to_char(DATE_CREATED, 'YYYY-MM')
order by 1

References