Re: Query to return every 1st Sat of a month between two dates

Поиск
Список
Период
Сортировка
От Michael Nolan
Тема Re: Query to return every 1st Sat of a month between two dates
Дата
Msg-id BANLkTi=DS462ZB1awq1dMD0tY=jWWZOQig@mail.gmail.com
обсуждение исходный текст
Ответ на Query to return every 1st Sat of a month between two dates  (Alex - <aintokyo@hotmail.com>)
Список pgsql-general


On Wed, May 11, 2011 at 10:22 AM, Alex - <aintokyo@hotmail.com> wrote:
Hi,
is there an easy way to return the date of every first Saturday of a month in a data range i.e. 2011-2013


This is one way to do it:, there are others:

select '2011-01-01'::date + s.a as dates from generate_series(0,1095)
as s(a)
where to_char('2011-01-01'::date+s.a,'dd') between '01' and '07'
and to_char('2011-01-01'::date+s.a,'dy') = 'sat'
 
--
Mike Nolan

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

Предыдущее
От: Bborie Park
Дата:
Сообщение: Returning NULL to a set returning C type function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Returning NULL to a set returning C type function