Received: from huey.jpl.nasa.gov (huey.jpl.nasa.gov [128.149.68.100]) by hub.org (8.10.1/8.10.1) with ESMTP id e5SEAh188102 for ; Wed, 28 Jun 2000 10:10:43 -0400 (EDT) Received: from golem.jpl.nasa.gov (hectic-1 [128.149.68.203]) by huey.jpl.nasa.gov (8.8.8+Sun/8.8.8) with ESMTP id HAA20399; Wed, 28 Jun 2000 07:10:26 -0700 (PDT) Received: from alumni.caltech.edu (localhost.localdomain [127.0.0.1]) by golem.jpl.nasa.gov (Postfix) with ESMTP id CF8646F4F; Wed, 28 Jun 2000 14:12:34 +0000 (UTC) Message-ID: <395A07D2.9947951F@alumni.caltech.edu> Date: Wed, 28 Jun 2000 14:12:34 +0000 From: Thomas Lockhart Organization: Yes X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.14-15mdksmp i686) X-Accept-Language: en MIME-Version: 1.0 To: Antti Linno Cc: pgsql-sql@postgresql.org Subject: Re: extract last months data References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200006/257 > I just want to extract last months data, but I don't know whether the > month ended with 29,30 or 31 (external program, that uses postgres), select * from t1 where d >= (date_trunc('month', timestamp 'today') - interval '1 month') and d < date_trunc('month', timestamp 'today'); - Thomas