... - Mailing list pgsql-novice

From Gan Uesli Starling
Subject ...
Date
Msg-id 20060131151028.17040.qmail@mail_102.selectedhosting.com
Whole thread Raw
Responses Re:  (Tom Lane <tgl@sss.pgh.pa.us>)
Re:  (<operationsengineer1@yahoo.com>)
List pgsql-novice
My problem is this:

I have a table 'history' with columns for ''date_time', 'event', 'sensor'.

The 'event' column may contain 'Calibrated', 'Damaged', 'Repaired'.

Since it is a history, the same sensor may be listed multiple times with a
date for each event.

I want only the most recent calibration event for undamaged sensors.

I am trying to figure out how to winnow out in a single query (no
intermediate
tables) the most recent event for each sensor which has been 'Calibrated' or
'Repaired' not 'Damaged' afterwards.

I had thought it would be so simple. But after much wrangling I seem to be
stumped.

 --
Mistera Sturno - Rarest Extinct Bird

<(+)__        Gan Uesli Starling
 ((__/)=-    Kalamazoo, MI, USA
  `||`
   ++        http://starling.us

pgsql-novice by date:

Previous
From: Tomka Gergely
Date:
Subject: Re: lost archives, alpha data files
Next
From: Murat Tasan
Date:
Subject: function returning a setof a column type