16.20 - Example SQL for Pie Chart - Teradata Ecosystem Manager

Teradata® Ecosystem Manager User Guide

Product
Teradata Ecosystem Manager
Release Number
16.20
Published
December 2020
Language
English (United States)
Last Update
2020-12-23
dita:mapPath
crn1512743909724.ditamap
dita:ditavalPath
ft:empty
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.