Selecting consecutive dates as integers in yyyymmdd format

Поиск
Список
Период
Сортировка
От AlexK
Тема Selecting consecutive dates as integers in yyyymmdd format
Дата
Msg-id 1392848293186-5792815.post@n5.nabble.com
обсуждение исходный текст
Ответы Re: Selecting consecutive dates as integers in yyyymmdd format  (bricklen <bricklen@gmail.com>)
Список pgsql-sql
The following code gets the job done, but I am wondering if there is a
simpler/cleaner way? 

WITH start_date AS(SELECT DATE '2014-02-18' AS start_date)
select CAST( to_char(start_date + INTERVAL '1d'*i,'YYYYMMDD') AS INT) AS
end_range 
from generate_series(1,100) AS i CROSS JOIN start_date;

end_range
integer

20140219
20140220
20140221
20140222
20140223
20140224
20140225
20140226
20140227
20140228
20140301
20140302
(snip)



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Selecting-consecutive-dates-as-integers-in-yyyymmdd-format-tp5792815.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



В списке pgsql-sql по дате отправления:

Предыдущее
От: AlexK
Дата:
Сообщение: Re: How to unnest an array with element indexes
Следующее
От: bricklen
Дата:
Сообщение: Re: Selecting consecutive dates as integers in yyyymmdd format