{"provider_url":"https://hatena.blog","author_url":"https://blog.hatena.ne.jp/kwbtblog/","blog_title":"Welcome to new things","image_url":"https://cdn-ak.f.st-hatena.com/images/fotolife/k/kwbtblog/20190627/20190627001546.png","blog_url":"https://www.ekwbtblog.com/","provider_name":"Hatena Blog","url":"https://www.ekwbtblog.com/entry/2019/09/13/152749","width":"100%","height":"190","published":"2019-09-13 15:27:49","categories":["Azure","DATE_TRUNC","MSSQL","SQL","SQL Database","SQL Server","data analysis"],"version":"1.0","type":"rich","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.ekwbtblog.com%2Fentry%2F2019%2F09%2F13%2F152749\" title=\"How to do monthly/weekly aggregation in SQL Server - Welcome to new things\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","title":"How to do monthly/weekly aggregation in SQL Server","description":"To aggregate data by month/week, first find the beginning date of the month/week of the date and GROUP by that beginning date. If the DATE_TRUNC() function can be used to get the head date, such as Google BigQuery, you can aggregate the data as follows. SELECT DATE_TRUNC(dt, MONTH) AS dt_month ,SUM(\u2026","author_name":"kwbtblog"}