Created
February 9, 2015 20:09
-
-
Save ajlai/0b5d7ae33d2c22b131f5 to your computer and use it in GitHub Desktop.
Date series on redshift
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
WITH date_series_bounds AS ( | |
SELECT date('2012-12-21') as start, date('2013-08-23') as end | |
), date_series AS ( | |
select date(days.start + days.interval) | |
from ( | |
select bounds.start, generate_series(0, bounds.end - bounds.start) AS interval from date_series_bounds bounds | |
) as days | |
) | |
select * from date_series | |
-- 2012-12-21 | |
-- 2012-12-22 | |
-- ... | |
-- 2013-08-22 | |
-- 2013-08-23 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment