I come across this beautiful link - How can I return pivot table output in MySQL?
Which solves my exact problem. However, I need one of the columns as sum of the value - which is an amount column
How to add a sum of a column in the query. Please advise.