I need help with the following output. Tried case, Distinct, Group By, failed. Join might help, but still couldn't write a query with join.
Welcome on dba.stackexchange. Please be more specific in future request. But I still think I can extract the gist of your request:
Since too many questions concerning your request are unclear I just point you to this guide (myself not working on MS SQL): https://docs.microsoft.com/en-us/sql/t-sql/queries/from-using-pivot-and-unpivot?view=sql-server-ver15
This means you need to select the (the names in your axample), choose the aggregate function (sum of AMOUNTS) and in the FOR-clause choose the , i.e. the rubrics (column SALARY_HEAD).
Hope that helps to get you started Andreas