Select latest Timestamp values with group by

From: Adarsh Sharma <adarsh(dot)sharma(at)orkash(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Select latest Timestamp values with group by
Date: 2011-10-10 12:32:05
Message-ID: 4E92E5C5.3090002@orkash.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear all,

I need to write a query to select latest rows with timestamp values.
My ID is repeated with lat lon and timestamp. I want the latest row of
each ID ( group by id ).

Snapshot of small dataset :-

"3903";"661000212";34.3000000312542;74.4666670842472;0;"2011-10-10
12:47:33.360572"
"3904";"661000212";24.816667028954;93.9500000453283;0;"2011-10-10
12:47:33.360572"
"3905";"661000212";24.816667028954;93.9500000453283;0;"2011-10-20
12:47:33.360572"
"3906";"661000213";24.816667028954;93.9500000453283;0;"2011-10-10
12:47:33.360572"
"3907";"661000212";24.816667028954;93.9500000453283;0;"2011-10-10
12:47:33.360572"
"3908";"661000212";24.816667028954;93.9500000453283;0;"2011-10-10
12:47:33.360572"
"3909";"661000212";25.1166670062712;94.3666669968243;0;"2011-10-10
12:47:33.360572"
"3910";"661000213";26.8491101532852;92.8058205131302;0;"2011-10-10
12:47:33.360572"
"3911";"661000212";26.8491101532852;92.8058205131302;0;"2011-10-14
12:47:33.360572"

Can anyone let me know the query for that.

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-10-10 13:09:35 Re: Postgres 9.01, Amazon EC2/EBS, XFS, JDBC and lost connections
Previous Message Albe Laurenz 2011-10-10 11:59:31 Re: Permission for pg_shadow.