Re: BirthDay SQL Issue
| От | Richard Huxton |
|---|---|
| Тема | Re: BirthDay SQL Issue |
| Дата | |
| Msg-id | 43438F0C.7050406@archonet.com обсуждение исходный текст |
| Ответ на | BirthDay SQL Issue (brett <bhalligan@yahoo.com>) |
| Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления: