Received: from phoenix.nanospace.com (phoenix.nanospace.com [209.213.199.19]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f0F1pfp08583 for ; Sun, 14 Jan 2001 20:51:41 -0500 (EST) (envelope-from dalgoda@ix.netcom.com) Received: (qmail 8295 invoked from network); 15 Jan 2001 01:51:38 -0000 Received: from workstation-209-213-222-98.yy.com (HELO thune.mrc-home.org) (209.213.222.98) by phoenix.nanospace.com with SMTP; 15 Jan 2001 01:51:38 -0000 Received: by thune.mrc-home.org (8.10.0) id f0F1pYj07646; Sun, 14 Jan 2001 17:51:34 -0800 Date: Sun, 14 Jan 2001 17:51:33 -0800 From: Mike Castle To: Postgres SQL list Subject: Re: Using INDEX on date/time values // Re: how to select a time frame on timestamp rows. Message-ID: <20010114175133.C3604@thune.yy.com> Reply-To: Mike Castle Mail-Followup-To: Mike Castle , Postgres SQL list References: <3A612100.D68ABDE8@merz-akademie.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.6i In-Reply-To: <3A612100.D68ABDE8@merz-akademie.de>; from alvar.freude@merz-akademie.de on Sun, Jan 14, 2001 at 04:46:08AM +0100 X-Archive-Number: 200101/137 X-Sequence-Number: 798 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@ix.netcom.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