Loading...

Example: Join Data Set

To see an example of a join data set in a report, view the Summary data set in the Restore Job Summary Report.

Query

The following query is used to create the Summary data set.

SELECT [Data Source], [Agent Type],
SUM(CASE WHEN [Status Code] = 1 THEN 1 ELSE 0 END) AS [Completed],
SUM(CASE WHEN [Status Code] = 2 THEN 1 ELSE 0 END) AS [Completed with Errors],
SUM(CASE WHEN [Status Code] = 3 THEN 1 ELSE 0 END) AS [Completed with Warnings],
SUM(CASE WHEN [Status Code] = 4 THEN 1 ELSE 0 END) AS [Failed],
SUM(CASE WHEN [Status Code] = 5 THEN 1 ELSE 0 END) AS [Killed],
SUM(CASE WHEN [Status Code] = 6 THEN 1 ELSE 0 END) AS [Delayed],
SUM(CASE WHEN [Status Code] = 7 THEN 1 ELSE 0 END) AS [Running],
SUM([Size (GB)]) AS [Total Size (GB)]
FROM :[Restore Jobs]
GROUP BY [Data Source], [Agent Type]
ORDER BY [Data Source], [Agent Type]

Last modified: 4/4/2019 2:47:08 PM