Skip site navigation (1) Skip section navigation (2)

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 (view raw, whole thread or download thread mbox)
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
extract(month FROM contact.dob ) = 6
and extract(day FROM contact.dob) >= 15
and extract(day FROM contact.dob) <= 30

Thanks for any suggestions...


Chris Campbell
Cascasde Data Solutions Inc.


pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group