Selecting latest value

From: Patrik Kudo <kudo(at)partitur(dot)se>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Selecting latest value
Date: 2001-09-18 16:22:55
Message-ID: Pine.BSF.4.31.0109181816420.74890-100000@tb303.partitur.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I have a table which basically looks like this:

create table (userid text, val integer, ts timestamp);

This table holds multiple values for users, timestamped for history
reasons.

Now I need to fetch the latest val for each userid to insert into a new
table (with about the same schema, except for uniqueness on userid).
I belive this should be a trivial task, but I'm experience total lack of
insight here...

Comments?

/Patrik Kudo

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Denis Bucher 2001-09-18 17:07:34 URGENT ! Nouveau virus
Previous Message Josh Berkus 2001-09-18 15:31:49 Holiday Calculations?