Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 3CA382E0048 for ; Thu, 24 Apr 2008 10:11:23 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 42809-04 for ; Thu, 24 Apr 2008 10:11:05 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from interscan.indicator.com (mail.indicator.be [193.121.199.3]) by developer.postgresql.org (Postfix) with ESMTP id 2D9CC2E003D for ; Thu, 24 Apr 2008 10:11:12 -0300 (ADT) Received: from DOMEXT-MTA by WEBACCESS.INDICATOR.BEwith Novell_GroupWise; Thu, 24 Apr 2008 15:11:10 +0200 Message-Id: <4810A306.A3DD.0030.0@indicator.be> X-Mailer: Novell GroupWise Internet Agent 7.0.2 Date: Thu, 24 Apr 2008 15:11:03 +0200 From: "Bart Degryse" To: , "Frank Bax" Subject: Re: First day of month, last day of month References: <481085D1.2010807@sympatico.ca> In-Reply-To: <481085D1.2010807@sympatico.ca> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__Part416814F7.0__=" X-imss-version: 2.050 X-imss-result: Passed X-imss-approveListMatch: *@indicator.be X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/151 X-Sequence-Number: 30690 --=__Part416814F7.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable select * from mytable where date_trunc('month', mydate) =3D date_trunc('mon= th', now()); >>> Frank Bax 2008-04-24 15:06 >>> Nacef LABIDI wrote: > is there a better method to retrieve all=20 > the rows with dates in the current month. select * from mytable where extract(month from mydate) =3D extract(month=20= from now()) and extract(year from mydate) =3D extract(year from now()); --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql --=__Part416814F7.0__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable select * from = mytable where date_trunc('month', mydate) =3D date_trunc('month', = now());


>>> Frank Bax <fbax@sympatico.ca> = 2008-04-24 15:06 >>>
Nacef LABIDI wrote:
> is there a = better method to retrieve all
> the rows with dates in the current = month.


select * from mytable where extract(month from mydate) = =3D extract(month
from now()) and extract(year from mydate) =3D = extract(year from now());

--
Sent via pgsql-sql mailing list = (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org= /mailpref/pgsql-sql
--=__Part416814F7.0__=--