pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Lockhart <lockhart@alumni.caltech.edu>
To: Antti Linno <alligator@all.ee>
Cc: pgsql-sql@postgresql.org
Subject: Re: Aww, sorry (last day of month)
Date: Wed, 05 Jul 2000 14:51:11 +0000
Message-ID: <39634B5F.4ABB9DE4@alumni.caltech.edu> (raw)
References: <Pine.LNX.4.04.10007051549540.13491-100000@all.ee>

> 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



view thread (2+ messages)

Message-ID: <39634B5F.4ABB9DE4@alumni.caltech.edu>
Permalink:  ../39634B5F.4ABB9DE4@alumni.caltech.edu/
Also on:    postgresql.org/message-id/39634B5F.4ABB9DE4@alumni.caltech.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: lockhart@alumni.caltech.edu, alligator@all.ee
  Subject: Re: Aww, sorry (last day of month)
  In-Reply-To: <39634B5F.4ABB9DE4@alumni.caltech.edu>
  References: <Pine.LNX.4.04.10007051549540.13491-100000@all.ee> <39634B5F.4ABB9DE4@alumni.caltech.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox