Skip to content

Instantly share code, notes, and snippets.

@dwihujianto
Created November 6, 2019 21:57
Show Gist options
  • Save dwihujianto/a8a256ab5046a9939d9d5206d26ca031 to your computer and use it in GitHub Desktop.
Save dwihujianto/a8a256ab5046a9939d9d5206d26ca031 to your computer and use it in GitHub Desktop.
SELECT DATE_FORMAT(merge_date,'%m-%Y') AS month FROM (
SELECT '2015-01-01' AS merge_date
UNION SELECT '2015-02-01' AS merge_date
UNION SELECT '2015-03-01' AS merge_date
UNION SELECT '2015-04-01' AS merge_date
UNION SELECT '2015-05-01' AS merge_date
UNION SELECT '2015-06-01' AS merge_date
UNION SELECT '2015-07-01' AS merge_date
UNION SELECT '2015-08-01' AS merge_date
UNION SELECT '2015-09-01' AS merge_date
UNION SELECT '2015-10-01' AS merge_date
UNION SELECT '2015-11-01' AS merge_date
UNION SELECT '2015-12-01' AS merge_date
) AS m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment