help with limiting query results - Mailing list pgsql-sql

From OizOne
Subject help with limiting query results
Date
Msg-id 20040113193312.05BDAEB4942@gw02.mail.saunalahti.fi
Whole thread Raw
Responses Re: help with limiting query results
List pgsql-sql
Hi,

I have the following table in postgres:

hostname |   username    |         logontime
----------+---------------+----------------------------ws1      | rautaonn      | 2004-01-13 21:25:01.100336ws1      |
administrator| 2004-01-13 21:25:07.706546ws1      | testuser      | 2004-01-13 21:25:16.084844ws2      | testuser
|2004-01-13 21:25:18.683653ws2      | testuser2     | 2004-01-13 21:25:20.862199ws2      | administrator | 2004-01-13
21:25:25.932736ws2     | oizone        | 2004-01-13 21:25:30.107574 



and I would need to create a query that selects each hostname only once with
username that has the latest timestamp in the logontime column.
The real table has about 5000 rows with ¨500 different hostnames, and I
would need this query for reporting. Any help would be appreciated.

Thank in advance.

-Onni Rautanen



pgsql-sql by date:

Previous
From: jclaudio@capitol.fr
Date:
Subject: problem with function trigger
Next
From: sad
Date:
Subject: DROP TRIGGER