Re: Aww, sorry (last day of month)

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Antti Linno <alligator(at)all(dot)ee>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Aww, sorry (last day of month)
Date: 2000-07-05 14:51:11
Message-ID: 39634B5F.4ABB9DE4@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Martin, Sylvain R. (LNG) 2000-07-05 14:56:21 bug in using index scans?
Previous Message Thomas Lockhart 2000-07-05 14:34:40 Re: Problem with joins