Created
October 2, 2018 03:14
-
-
Save ichux/4c573030f4dda4ccf9a075ce2daeec17 to your computer and use it in GitHub Desktop.
lists all the months in a given year interval et al
This file contains hidden or 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 month_day1 :: DATE AS month_starts, | |
| (month_day1 + INTERVAL '1 month' - INTERVAL '1 day') :: DATE AS month_ends, | |
| (month_day1 + INTERVAL '1 month') :: DATE AS next_month_starts, | |
| (month_day1 + INTERVAL '1 month') :: DATE - month_day1 :: DATE AS days | |
| FROM generate_series(DATE '2018-01-01', DATE '2018-12-01', INTERVAL '1 month') AS month_day1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment