Skip to content

Commit 8825ef5

Browse files
committed
sql 1179 added
1 parent d1bc883 commit 8825ef5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

database/1179.sql

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* 1179 Reformat Department Table */
2+
SELECT id,
3+
SUM(IF(month='Jan',revenue,null)) AS 'Jan_Revenue',
4+
SUM(IF(month='Feb',revenue,null)) AS 'Feb_Revenue',
5+
SUM(IF(month='Mar',revenue,null)) AS 'Mar_Revenue',
6+
SUM(IF(month='Apr',revenue,null)) AS 'Apr_Revenue',
7+
SUM(IF(month='May',revenue,null)) AS 'May_Revenue',
8+
SUM(IF(month='Jun',revenue,null)) AS 'Jun_Revenue',
9+
SUM(IF(month='Jul',revenue,null)) AS 'Jul_Revenue',
10+
SUM(IF(month='Aug',revenue,null)) AS 'Aug_Revenue',
11+
SUM(IF(month='Sep',revenue,null)) AS 'Sep_Revenue',
12+
SUM(IF(month='Oct',revenue,null)) AS 'Oct_Revenue',
13+
SUM(IF(month='Nov',revenue,null)) AS 'Nov_Revenue',
14+
SUM(IF(month='Dec',revenue,null)) AS 'Dec_Revenue'
15+
FROM Department
16+
GROUP BY id;

0 commit comments

Comments
 (0)