Hi Guys,

Please refer to my query below:

      SELECT A.WorkPeriod,
	         (SELECT B.ProjCode
                     FROM tblCharge AS B
		    INNER JOIN tblProj AS C
		         ON B.ProjectCode = C.Code
		   WHERE A.EmployeeCode = B.EmployeeCode ) AS ProjCode,
                 SUM(Pay) AS Pay,
                 SUM(Deminimis) AS Deminimis,
                 SUM(Other) AS Other,
                 SUM(Gift) AS Gift,
                 SUM(Allowance) AS Allowance,
                 SUM(Loan) AS Loan,
                 SUM(SEC) As SEC,
                 SUM(FCAL) AS FCAL
        FROM vyu_GetEmpDetails
      WHERE WorkPeriod= '2020-08-B'
          AND A.DepartmentDesc != 'DED'
      GROUP BY GROUPING SETS ((A.WorkPeriod, A.EmployeeCode, A.EmployeeName, A.DepartmentDesc), (A.DepartmentDesc))
The output is like this:

Name:  Output.jpg
Views: 36
Size:  24.5 KB

But I'm expecting something like this:

Name:  Result.jpg
Views: 32
Size:  25.1 KB

Can anyone help me how to achieve the latter result using grouping sets, cause i can't use ROLLUP and CUBE due to its not supported.

Thank you