I have one table (by Excerpt Include macro) inside a Table Transformer macro with following columns
DeptId, ManagerId, EmployeeId, Salary
I want to show total salary by DeptId and ManagerId
But
I want to order the records in descending order of total salary by department
Select TA.*
FROM
(Select T1.'DeptId', T1.'ManagerId', SUM(T1.'Salary') 'Dept-Manager Salary'
FROM T1
GROUP BY T1.'DeptId', T1.'ManagerId') AS TA
JOIN
(Select T1.'DeptId', SUM(T1.'Salary') 'Dept Salary'
FROM T1
GROUP BY T1.'DeptId') AS TB
ON TA.'DeptId' = TB.'DeptId'
ORDER BY
TB.'Dept Salary' DESC
Why is this not working as expected?