Last active
July 25, 2016 07:50
-
-
Save chanakaDe/19edf40a1098750aea8f136ca9b5e41f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT 'January' AS mName, 1 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 1 | |
UNION | |
SELECT 'February' AS mName, 2 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 2 | |
UNION | |
SELECT 'March' AS mName, 3 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 3 | |
UNION | |
SELECT 'April' AS mName, 4 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 4 | |
UNION | |
SELECT 'May' AS mName, 5 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 5 | |
UNION | |
SELECT 'June' AS mName, 6 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 6 | |
UNION | |
SELECT 'July' AS mName, 7 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 7 | |
UNION | |
SELECT 'August' AS mName, 8 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 8 | |
UNION | |
SELECT 'September' AS mName, 9 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 9 | |
UNION | |
SELECT 'October' AS mName, 10 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 10 | |
UNION | |
SELECT 'November' AS mName, 11 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 11 | |
UNION | |
SELECT 'December' AS mName, 12 AS mOrder, COALESCE(SUM(amount),0) AS total_num | |
FROM income i | |
WHERE month(i.date) = 12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment