Generate a row per minute of the day from a sparsely populated database table

前端 未结 2 1303
耶瑟儿~
耶瑟儿~ 2021-01-03 08:41

I have a table populated with time stamped rows inserted at (essentially) random point in the day.

I need to generate running totals with 1 row per minute (so for a

2条回答
  •  心在旅途
    2021-01-03 09:36

    You'll want to use group by for sure. The hard(ish) part is that it'll be synthetic, meaning you'll have to create it yourself. There are a bunch of ways to do that

    GROUP BY year(yourdate), month(yourdate), day(yourdate) etc...

    Except I can't remember if there are hours() and minutes() functions off the top of my head.

    You can also use the datepart function.

    Then you can put those all together in one column for a nice looking label.

提交回复
热议问题