2011/5/11 Alex - <ainto...@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 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general