Selecting latest value - Mailing list pgsql-sql

From Patrik Kudo
Subject Selecting latest value
Date
Msg-id Pine.BSF.4.31.0109181816420.74890-100000@tb303.partitur.se
Whole thread Raw
Responses Re: Selecting latest value
List 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



pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Holiday Calculations?
Next
From: Tom Lane
Date:
Subject: Re: Out of free buffers... HELP!