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 e65EmMS11550 for ; Wed, 5 Jul 2000 10:48:22 -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 HAA04300; Wed, 5 Jul 2000 07:47:50 -0700 (PDT) Received: from alumni.caltech.edu (localhost.localdomain [127.0.0.1]) by golem.jpl.nasa.gov (Postfix) with ESMTP id 48E0B6F4F; Wed, 5 Jul 2000 14:51:11 +0000 (UTC) Message-ID: <39634B5F.4ABB9DE4@alumni.caltech.edu> Date: Wed, 05 Jul 2000 14:51:11 +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: Aww, sorry (last day of month) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200007/46 > What i ment was, that I have information about workers, and I have to make > report on them. Report should contain status about workers with the > restriction , that the data is about last day of the month. I use perl as > a scripting language, and how the hell should I know how many days were in > that particular month (28,29,30,31) :). If there are no means by doing it > in sql, I write a code to ask for a , mmm, special day. *sigh* > Maybe something with date_trunc? Someone else had the suggestion, but specifically something like ... where d1 >= (date_trunc('month', timestamp 'today') - interval '1 day') and d1 < date_trunc('month', timestamp 'today'); should get you data for the previous month. Substitute the "today" field for something else as you may require. - Thomas