pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Ansley (UK) <Michael.Ansley@intec-telecom-systems.com>
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
To: Marc Sherman <msherman@projectile.ca>
Cc: pgsql-sql List <pgsql-sql@postgresql.org>
Subject: RE: Select most recent record?
Date: Wed, 16 May 2001 15:50:38 +0100
Message-ID: <7F124BC48D56D411812500D0B747251480F594@fileserver002.intecsystems.co.uk> (raw)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Um, I think that the intention was to group by id, and have the max
timestamp per id.  If that is the case, then the original query is
probably about the best.

Cheers...


MikeA



>> -----Original Message-----
>> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
>> Sent: 16 May 2001 15:36
>> To: Marc Sherman
>> Cc: pgsql-sql List
>> Subject: Re: [SQL] Select most recent record? 
>> 
>> 
>> "Marc Sherman" <msherman@projectile.ca> writes:
>> > I'd like to select the newest (max(timestamp)) row for each id,
>> > before a given cutoff date; is this possible?
>> 
>> select * from log order by timestamp desc limit 1;
>> 
>> 			regards, tom lane
>> 
>> ---------------------------(end of 
>> broadcast)---------------------------
>> TIP 2: you can get off all lists at once with the unregister
>> command 
>>     (send "unregister YourEmailAddressHere" to 
>> majordomo@postgresql.org)
>> 

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com;

iQA/AwUBOwKTsHympNV/C086EQLIAgCgo6Ypci5XK4iDsNSEzxf5o2XCnLcAoLUd
4qdproc00iw/9aAiVdwQBqm7
=cgTO
-----END PGP SIGNATURE-----

view thread (9+ messages)  latest in thread

Message-ID: <7F124BC48D56D411812500D0B747251480F594@fileserver002.intecsystems.co.uk>
Permalink:  ../7F124BC48D56D411812500D0B747251480F594@fileserver002.intecsystems.co.uk/
Also on:    postgresql.org/message-id/7F124BC48D56D411812500D0B747251480F594@fileserver002.intecsystems.co.uk

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: Michael.Ansley@intec-telecom-systems.com, tgl@sss.pgh.pa.us, msherman@projectile.ca
  Subject: Re: Select most recent record?
  In-Reply-To: <7F124BC48D56D411812500D0B747251480F594@fileserver002.intecsystems.co.uk>
  References: <7F124BC48D56D411812500D0B747251480F594@fileserver002.intecsystems.co.uk>

* 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