1179.sql (770B)
1 SELECT id, 2 SUM(IF(month = 'Jan', revenue, NULL)) AS Jan_Revenue, 3 SUM(IF(month = 'Feb', revenue, NULL)) AS Feb_Revenue, 4 SUM(IF(month = 'Mar', revenue, NULL)) AS Mar_Revenue, 5 SUM(IF(month = 'Apr', revenue, NULL)) AS Apr_Revenue, 6 SUM(IF(month = 'May', revenue, NULL)) AS May_Revenue, 7 SUM(IF(month = 'Jun', revenue, NULL)) AS Jun_Revenue, 8 SUM(IF(month = 'Jul', revenue, NULL)) AS Jul_Revenue, 9 SUM(IF(month = 'Aug', revenue, NULL)) AS Aug_Revenue, 10 SUM(IF(month = 'Sep', revenue, NULL)) AS Sep_Revenue, 11 SUM(IF(month = 'Oct', revenue, NULL)) AS Oct_Revenue, 12 SUM(IF(month = 'Nov', revenue, NULL)) AS Nov_Revenue, 13 SUM(if(month = 'Dec', revenue, NULL)) AS Dec_Revenue 14 FROM Department 15 GROUP BY id