Date operations

From: Barbara Figueirido <barbara(at)bariloche(dot)com(dot)ar>
To: pgsql-novice(at)postgresql(dot)org
Subject: Date operations
Date: 2011-03-01 02:03:47
Message-ID: 4D6C5403.6010002@bariloche.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello to all!
(Please excuse me if this is too noob and if it has already been
asked/answered, in that case would you please point me towards the
corresponding post or documentation? - TIA)

I have a table where I record the history of some
file-cabinet-paperwork, classifying it according to the persons
affected. There is a table (in fact, it's a view getting its input from
a couple of underlying tables) where I record the date of some action,
the name of the files and the type of action taken.

Now I want to search for those files that haven't been subject to any
action for some lapse of time, say backwards 3 months from now, but I
cannot figure how to phrase the search, since a "SELECT .... WHERE date
< somedate" retrieves all files where some action has been taken before
that period but doesn't exclude those that were being acted upon afterwards.

What I would like, if possible, is something on the line of "SELECT
DISTINCT ON file ..... WHERE date NOT GREATER THAN somedate [ORDER BY
date desc]" but cannot seem to find a way to do it.

I would greatly appreciate any ideas on this subject, kind regards to all,
Barbara F.

--
Dra. Bárbara M. Figueirido
25 de Mayo 1331
8400 S.C. de Bariloche - RIO NEGRO
Argentina
Tel.-Fax: +54 2944 456252
15682745

Attachment Content-Type Size
barbara.vcf text/x-vcard 224 bytes

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bastiaan Olij 2011-03-01 03:01:43 Backups and SSL
Previous Message Joel 2011-02-28 22:49:31 Re: Not accepting passwords for remote logins Mac OS X Server 10.6.5