Question : Assist with query

I have the following query which I need to rework so it only shows the previous days data. The data on the SQL server is stored as GMT time while the person running the query might not be set the same. I need the query to look at what today's date is and then only show all data for the devices for the pervious day 00:00 unti 23:59:59.

Thanks for your help!

SELECT Convert(DateTime,Floor(Cast(DateTime as Float)),0) AS SummaryDate,
Nodes.NodeID AS NodeID,
Nodes.Caption AS NodeName,
Nodes.IP_Address AS IP_Address,
AVG(ResponseTime.Availability) AS AVERAGE_of_Availability,
Nodes.AvgResponseTime AS Average_Response_Time,
Nodes.CPULoad AS Avg_CPULoad, avg(nodes.PercentMemoryUsed) as AVG_MemoryUsed

FROM
Nodes INNER JOIN ResponseTime ON (Nodes.NodeID = ResponseTime.NodeID)

WHERE
( DateTime >= dateadd(dd,-1, getdate() ))
and   (Nodes.CPULoad >= 0)

GROUP BY Convert(DateTime,Floor(Cast(DateTime as Float)),0),
Nodes.NodeID, Nodes.Caption, Nodes.IP_Address, Nodes.AvgResponseTime,Nodes.CPULoad ,nodes.PercentMemoryUsed

ORDER BY Caption ASC, 4 ASC

Answer : Assist with query

Hi edrz01,

assuming everything else in your query is ok,

Here is how to modify the Where clause to select all the time entries for the previous day from 00:00:00 to 23:59:59

1:
2:
3:
4:
WHERE
( DateTime >= CONVERT(VARCHAR(10), dateadd("dd", -1,GETDATE()), 120) + ' 00:00:00' )
and  (DateTime <= CONVERT(VARCHAR(10), dateadd("dd", -1,GETDATE()), 120) + ' 23:59:59')
and   (Nodes.CPULoad >= 0)
Random Solutions  
 
programming4us programming4us