Consider a scenario you want to create a quick report from a table product in SQL showing total product sold over the last 12 months, in which each column represents the month, last column could be the YTD sales. There will be the horizontal sub-total for each category for example sale by products, regions etc.