declare @Days int set @Days = -1 select dateadd(hour,datepart(hour,Timestamp),cast(CAST((Timestamp) as date) as datetime)) as [Time] ,[Value] from [Employee] where dateadd(hour,datepart(hour,Timestamp),cast(CAST((Timestamp) as date) as datetime)) >= CONVERT(date, DATEADD(DAY, @Days, GETDATE()))
DECLARE @Days int = -1; SELECT CAST(Timestamp AS date) AS date , AVG(Value) AS Value FROM [Employee] WHERE Timestamp >= DATEADD(day, @Days, CAST(GETDATE() AS date)) GROUP BY CAST(Timestamp AS date) ORDER BY date;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)