From: "Gan Uesli Starling" <alias(at)starling(dot)us>
To: pgsql-novice(at)postgresql(dot)org
Subject:
Date: 2006-01-31 15:10:28
Message-ID: 20060131151028.17040.qmail@mail_102.selectedhosting.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

  • Re: at 2006-01-31 15:48:10 from Tom Lane
  • Re: at 2006-02-02 00:38:41 from operationsengineer1

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2006-01-31 15:48:10 Re:
Previous Message Tomka Gergely 2006-01-31 15:07:30 Re: lost archives, alpha data files