I have this table structure:
ID BIGINT IDENTITY(1,1)
deviceID BIGINT NOT NULL,
entryTime DATETIME2 NOT NULL,
value FLOAT,
PRIMARY KEY (ID),
UNIQUE KEY (deviceID, entryTime)
I have about 15 million rows in this table and I want to fill another table with aggregated data from this table. I want to group this data by deviceID into “buckets” of size one day and take the min, max, and average of the values for that day. Any idea how I do that?
Something like: