From: Tom Lane <tgl@sss.pgh.pa.us>
To: OizOne <rautaon@nic.fi>
Cc: pgsql-sql@postgresql.org
Subject: Re: help with limiting query results
Date: Sun, 18 Jan 2004 23:54:46 -0500
Message-ID: <20559.1074488086@sss.pgh.pa.us> (raw)
In-Reply-To: <20040113193312.05BDAEB4942@gw02.mail.saunalahti.fi>
References: <20040113193312.05BDAEB4942@gw02.mail.saunalahti.fi>
"OizOne" <rautaon@nic.fi> writes:
> I would need to create a query that selects each hostname only once with
> username that has the latest timestamp in the logontime column.
SELECT DISTINCT ON is a convenient way to do this. See the "weather
reports" example in the SELECT reference page for a similar case.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, rautaon@nic.fi
Subject: Re: help with limiting query results
In-Reply-To: <20559.1074488086@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox