15.11 - Example SQL for Pie Chart - Teradata Ecosystem Manager

Teradata Ecosystem Manager User Guide

prodname
Teradata Ecosystem Manager
vrm_release
15.11
created_date
May 2016
category
User Guide
featnum
B035-3201-056K
The following is example SQL to create a pie chart that displays a report showing the overall state of applications. To display a pie chart, the SQL must limit the result set to 20 rows or less.
SELECT st.StateName, COUNT(*) NumApplications
FROM
	( SELECT applicationId, Min(TRIM(COALESCE((CASE WHEN COALESCE(DaemonGroupAggStateCode,0) > COALESCE(DatabaseAggStateCode,0) THEN DaemonGroupAggStateCode ELSE DatabaseAggStateCode END),10)) ) AS stateCode FROM MSMApplication GROUP BY 1
) ast 
INNER JOIN 
	MSMState st ON st.StateCode=ast.StateCode
GROUP BY st.StateName
The Report Viewer portlet displays the following pie chart.