Quantcast
Channel: THWACK: Discussion List - All Communities
Viewing all articles
Browse latest Browse all 16365

convert SQL to SWQL

$
0
0

Can any one helpme convert below sql query to SWQL. Basically this query give output in chart for custom time period.(exclude daily maintenance period 01.00am to 03.00am)

 

DECLARE @StartDate DATETIME, @EndDate DATETIME

SET @StartDate = dateadd(mm, -1, getdate())

SET @StartDate = dateadd(dd, datepart(dd, getdate())*-1, @StartDate)

SET @EndDate = dateadd(mm, 1, @StartDate)

 

 

SELECT  TOP 999999999 Convert(DateTime,Floor(Cast((DateTime) as Float)*24)/24,0) AS SummaryDateTime,

Nodes.Caption AS NodeName,

Nodes.IP_Address AS IP_Address,

AVG(CPULoad.AvgLoad) AS AVERAGE_of_AvgCPULoad,

Nodes.NodeID AS NodeID

 

FROM

Nodes INNER JOIN CPULoad ON (Nodes.NodeID = CPULoad.NodeID)

 

WHERE

( DateTime BETWEEN @startDate AND @EndDate )

 

AND

Nodes.caption = '${caption}'

 

 

AND

CONVERT(varchar, DateTime,108) BETWEEN '03:00:00' AND '12:59:00'

)

 

GROUP BY Convert(DateTime,Floor(Cast((DateTime) as Float)*24)/24,0),

Nodes.Caption, Nodes.IP_Address, Nodes.NodeID

 

ORDER BY SummaryDateTime ASC


Viewing all articles
Browse latest Browse all 16365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>