Quantcast
Channel: THWACK: All Content - Network Performance Monitor
Viewing all articles
Browse latest Browse all 21870

Report Writer Advanced SQL

$
0
0

Have the ability to pivot a table in a custom report to display it as columns instead of rows.  So for example I can currently generate a table like this:

SummaryMonthNodeGroupAverage Availability

January

NodeGroup1

NodeGroup2

99%

100%

February

NodeGroup1

NodeGroup2

100%

100%

March

NodeGroup1

NodeGroup2

95%

98%

But would like the option to pivot the table and display it like this:

NodeGroupJanuaryFebruary
NodeGroup199%100%
NodeGroup2100%100%

The above is just a sample of what I am after.  I am not sure the correct way to edit the SQL query to display the table the way I need it to look. I think I need to use a pivot command, but I do not know the syntax.  When I create a report in report writer, this is the SQL that is generated:

 

Select SummaryMonth,  Cast(AlertGroup01 As nvarchar(250)) as AlertGroup01, AVERAGE_of_Availability From ( SELECT  TOP 10000 CONVERT(DateTime,

LTRIM(MONTH(DateTime)) + '/01/' + LTRIM(YEAR(DateTime)),

101) AS SummaryMonth,

Nodes.AlertGroup01 AS AlertGroup01,

AVG(ResponseTime.Availability) AS AVERAGE_of_Availability

 

FROM

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

 

WHERE

( DateTime BETWEEN 41638 AND 41750 )

AND 

(

  (Nodes.AlertGroup01 = 'DAC-AI - Devices')

  (Nodes.AlertGroup01 = 'FNBA - Devices')

)

 

GROUP BY CONVERT(DateTime, LTRIM(MONTH(DateTime)) + '/01/' + LTRIM(YEAR(DateTime)), 101),

Nodes.AlertGroup01

 

) As r ORDER BY SummaryMonth ASC

 

I should say "AlertGroup01" is a custom property I created.  Any help on this would be greatly appreciated.


Viewing all articles
Browse latest Browse all 21870

Trending Articles



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