Hi.
MS Sql server.
I need to split a column to time periors (+30 minutes).
So I have only one column with datetime.
I need to do:
Value, Datetime(current) ---- Datetime(+30). One 30 minutes period
Value, Datetime(another datetime) ---- Datetime(+30). Another 30 minutes period
How would I go about?
I was thinking to have a min max or a datediff but or CTE but I'm not sure how to go about.
I've seen examples that consider an existing time period table but on my issue the main table has data + datetime.
Any suggestions?
Thanks.
Edit.So to be more precise:
Value 2018-01-01 15:00 -- 2018-01-01 15:30
Value 2018-01-01 15:00 -- 2018-01-01 15:30
Value 2018-01-01 15:00 -- 2018-01-01 15:30
Value 2018-01-01 15:31 -- 2018-01-01 16:00
Value 2018-01-01 15:31 -- 2018-01-01 16:00
Value 2018-01-01 16:01 -- 2018-01-01 16:30
Values 2018-01-01 16:01 -- 2018-01-01 16:30
----From one column
etc...