On Wed, May 11, 2011 at 10:22 AM, Alex - 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
if you want a list of the first saturdays of every month and you're
using at least 8.4:
with q as (select d, lag(d) over ()
2011/5/11 Alex - :
> 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
> Any help would be appreciated
> Thanks
> Alex
Try:
SELECT s.a::date+(6-(extract(dow from s.a)::int%7)) FROM
generate_series(to_date('2011',''),to_date('2012
Behalf Of Alex -
Sent: Wednesday, May 11, 2011 11:22 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Query to return every 1st Sat of a month between two
dates
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
Any help wo
On Wed, May 11, 2011 at 10:22 AM, Alex - 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)
wher
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
Any help would be appreciated
ThanksAlex