Received: from fileserver002.intecsystems.co.uk ([194.200.14.125]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4GEkwA13452 for ; Wed, 16 May 2001 10:46:59 -0400 (EDT) (envelope-from Michael.Ansley@intec-telecom-systems.com) Received: from fileserver002.intecsystems.co.uk (unverified) by fileserver002.intecsystems.co.uk (Content Technologies SMTPRS 4.1.5) with ESMTP id ; Wed, 16 May 2001 15:50:47 +0100 Received: by fileserver002.intecsystems.co.uk with Internet Mail Service (5.5.2650.21) id ; Wed, 16 May 2001 15:50:47 +0100 Message-ID: <7F124BC48D56D411812500D0B747251480F594@fileserver002.intecsystems.co.uk> From: "Michael Ansley (UK)" To: "'Tom Lane'" , Marc Sherman Cc: pgsql-sql List Subject: RE: Select most recent record? Date: Wed, 16 May 2001 15:50:38 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/alternative ; boundary="----_=_NextPart_001_01C0DE17.971E5D1C" X-Archive-Number: 200105/163 X-Sequence-Number: 2980 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C0DE17.971E5D1C Content-Type: text/plain; charset="iso-8859-1" -----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" 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 iQA/AwUBOwKTsHympNV/C086EQLIAgCgo6Ypci5XK4iDsNSEzxf5o2XCnLcAoLUd 4qdproc00iw/9aAiVdwQBqm7 =cgTO -----END PGP SIGNATURE----- ------_=_NextPart_001_01C0DE17.971E5D1C Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [SQL] Select most recent record?

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

Um, I think that the intention was to group by id, and ha= ve the max
timestamp per id.  If that is the case, then the or= iginal 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? <= /FONT>
>>
>>
>> "Marc Sherman" <msherman@projectil= e.ca> writes:
>> > I'd like to select the newest (max(timesta= mp)) row for each id,
>> > before a given cutoff date; is this possib= le?
>>
>> select * from log order by timestamp desc limit= 1;
>>
>>         &nbs= p;            regards, to= m lane
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 2: you can get off all lists at once with t= he 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/C086EQLIAgCgo6Ypci5XK4iDsNSEzxf5o2XCn= LcAoLUd
4qdproc00iw/9aAiVdwQBqm7
=3DcgTO
-----END PGP SIGNATURE-----



_________________________________________________________________________ This e-mail and any attachments are confidential and may also be privileged= and/or copyright
material of Intec Telecom Systems PLC (or its affiliated companies). If yo= u are not an
intended or authorised recipient of this e-mail or have received it in erro= r, please delete
it immediately and notify the sender by e-mail. In such a case, reading, r= eproducing,
printing or further dissemination of this e-mail is strictly prohibited and= may be unlawful.
Intec Telecom Systems PLC. does not represent or warrant that an attachment= hereto is free
from computer viruses or other defects. The opinions expressed in this e-ma= il and any
attachments may be those of the author and are not necessarily those of Int= ec Telecom
Systems PLC.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
__________________________________________________________________________<= BR>
------_=_NextPart_001_01C0DE17.971E5D1C--