Re: Using INDEX on date/time values // Re: how to select a time frame on timestamp rows.

From: Mike Castle <dalgoda(at)ix(dot)netcom(dot)com>
To: Postgres SQL list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Using INDEX on date/time values // Re: how to select a time frame on timestamp rows.
Date: 2001-01-15 01:51:33
Message-ID: 20010114175133.C3604@thune.yy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, Jan 14, 2001 at 04:46:08AM +0100, Alvar Freude wrote:
> Peter Eisentraut schrieb:
> >
> > > today i was trying to perform a query on a database using a time stamp
> > > field, i need to get all records which belong to year 2000, month 11,
> [...]
> > select user_name from tbacct where extract(month from acct_timestamp) = 11 ...
>
> is there any way of using an index for selecting some rows, e.g.
> selecting all data from one month?

What about select blah from foo where month >= 2000-11-01 and month < 2000-12-01

Fix up as appropriate.

mrc
--
Mike Castle Life is like a clock: You can work constantly
dalgoda(at)ix(dot)netcom(dot)com and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc
We are all of us living in the shadow of Manhattan. -- Watchmen

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Wagner 2001-01-15 08:33:22 using pg as a db backend in Access
Previous Message Max Pyziur 2001-01-14 20:28:44 Re: importing of ISO file to Postgresql