X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AC9C2DA177 for ; Wed, 5 Oct 2005 05:30:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12820-09 for ; Wed, 5 Oct 2005 08:30:21 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id B2602DA127 for ; Wed, 5 Oct 2005 05:30:22 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id C95D340C949; Wed, 5 Oct 2005 09:30:18 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id ABE0B15EE5; Wed, 5 Oct 2005 09:30:09 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 11664-03; Wed, 5 Oct 2005 09:30:04 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9590F15EDA; Wed, 5 Oct 2005 09:30:04 +0100 (BST) Message-ID: <43438F0C.7050406@archonet.com> Date: Wed, 05 Oct 2005 09:30:04 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050912) X-Accept-Language: en-us, en MIME-Version: 1.0 To: bhalligan@yahoo.com Cc: pgsql-sql@postgresql.org Subject: Re: BirthDay SQL Issue References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.058 required=5 tests=[AWL=0.008, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/29 X-Sequence-Number: 22882 brett wrote: > I need to be able to select two dates on my webby so I have a range of > dates > Then I want to be able to get, using some nifty query, everyone's > birthday that falls between those two dates. So if someone's birthday > was 04/09/79 it would return that tuple > > I have been stuck on this for ages. Any my search for help has brought > me here. You need to look at it from a different angle - don't try comparing dates, compare text instead. => SELECT to_char('2005-03-04'::date, 'MMDD'); to_char --------- 0304 (1 row) That should do it. Oh - you might want to read up on functional indexes in the manual too, if this is a query you'll be running regularly. -- Richard Huxton Archonet Ltd