pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bart Degryse <Bart.Degryse@indicator.be>
To: pgsql-sql@postgresql.org
To: Frank Bax <fbax@sympatico.ca>
Subject: Re: First day of month, last day of month
Date: Thu, 24 Apr 2008 15:11:03 +0200
Message-ID: <4810A306.A3DD.0030.0@indicator.be> (raw)
In-Reply-To: <481085D1.2010807@sympatico.ca>
References: <f16f7ea00804240559y6694c19fx102e57ea4455b07d@mail.gmail.com>
	<481085D1.2010807@sympatico.ca>

select * from mytable where date_trunc('month', mydate) = 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) = extract(month 
from now()) and extract(year from mydate) = 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

view thread (21+ messages)  latest in thread

Message-ID: <4810A306.A3DD.0030.0@indicator.be>
Permalink:  ../4810A306.A3DD.0030.0@indicator.be/
Also on:    postgresql.org/message-id/4810A306.A3DD.0030.0@indicator.be

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Bart.Degryse@indicator.be, fbax@sympatico.ca
  Subject: Re: First day of month, last day of month
  In-Reply-To: <4810A306.A3DD.0030.0@indicator.be>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox