Date searching by month & day only

From: Chris Campbell <ccampbell(at)cascadeds(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Date searching by month & day only
Date: 2012-03-13 21:42:46
Message-ID: 453A24085F801842AEA8D0B6B269065D020B2D9099FC@HDMC.cds.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello List,

I'm attempting to pull up a birthday list of anyone born between, let's say June 15 and June 30th. The year is irrelevant.

I'm wondering if there is a more elegant way to do this than using something like:

SELECT key, dob from ds1.contact
WHERE
extract(month FROM contact.dob ) = 6
and extract(day FROM contact.dob) >= 15
and extract(day FROM contact.dob) <= 30

Thanks for any suggestions...

Regards,

Chris Campbell
Cascasde Data Solutions Inc.
800.280.2090
ccampbell(at)cascadeds(dot)com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Steve Crawford 2012-03-13 22:09:22 Re: Date searching by month & day only
Previous Message Andrej 2012-03-13 19:55:31 Re: Updating RHEL4 system for PHP; requires Postgresql updates