Re: Aww, sorry (last day of month) - Mailing list pgsql-sql

From Thomas Lockhart
Subject Re: Aww, sorry (last day of month)
Date
Msg-id 39634B5F.4ABB9DE4@alumni.caltech.edu
Whole thread Raw
In response to Aww, sorry (last day of month)  (Antti Linno <alligator@all.ee>)
List pgsql-sql
> 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


pgsql-sql by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: Problem with joins
Next
From: "Martin, Sylvain R. (LNG)"
Date:
Subject: bug in using index scans?