Re: Query to return every 1st Sat of a month between two dates - Mailing list pgsql-general

From Osvaldo Kussama
Subject Re: Query to return every 1st Sat of a month between two dates
Date
Msg-id BANLkTi=u5P4oubo3o1Bv9rpKTFsA4AUfrg@mail.gmail.com
Whole thread Raw
In response to Query to return every 1st Sat of a month between two dates  (Alex - <aintokyo@hotmail.com>)
List pgsql-general
2011/5/11 Alex - <aintokyo@hotmail.com>:
> 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','YYYY'),to_date('2012','YYYY'), '1
month') AS s(a);

Osvaldo

pgsql-general by date:

Previous
From: Carlos Mennens
Date:
Subject: Remove Modifiers on Table
Next
From: Christopher Opena
Date:
Subject: Client-based EOFs triggering hung queries?