RE: Select most recent record? - Mailing list pgsql-sql
From | Michael Ansley (UK) |
---|---|
Subject | RE: Select most recent record? |
Date | |
Msg-id | 7F124BC48D56D411812500D0B747251480F594@fileserver002.intecsystems.co.uk Whole thread Raw |
In response to | Select most recent record? ("Marc Sherman" <msherman@projectile.ca>) |
List | pgsql-sql |
<p><font size="2">-----BEGIN PGP SIGNED MESSAGE-----</font><br /><font size="2">Hash: SHA1</font><p><font size="2">Um, Ithink that the intention was to group by id, and have the max</font><br /><font size="2">timestamp per id. If that is thecase, then the original query is</font><br /><font size="2">probably about the best.</font><p><font size="2">Cheers...</font><br/><p><font size="2">MikeA</font><br /><br /><p><font size="2">>> -----Original Message-----</font><br/><font size="2">>> From: Tom Lane [<a href="mailto:tgl@sss.pgh.pa.us">mailto:tgl@sss.pgh.pa.us</a>]</font><br/><font size="2">>> Sent: 16 May 2001 15:36</font><br/><font size="2">>> To: Marc Sherman</font><br /><font size="2">>> Cc: pgsql-sql List</font><br/><font size="2">>> Subject: Re: [SQL] Select most recent record? </font><br /><font size="2">>></font><br /><font size="2">>> </font><br /><font size="2">>> "Marc Sherman" <msherman@projectile.ca>writes:</font><br /><font size="2">>> > I'd like to select the newest (max(timestamp))row for each id,</font><br /><font size="2">>> > before a given cutoff date; is this possible?</font><br/><font size="2">>> </font><br /><font size="2">>> select * from log order by timestamp desclimit 1;</font><br /><font size="2">>> </font><br /><font size="2">>> regards, tom lane</font><br/><font size="2">>> </font><br /><font size="2">>> ---------------------------(end of </font><br/><font size="2">>> broadcast)---------------------------</font><br /><font size="2">>> TIP 2: youcan get off all lists at once with the unregister</font><br /><font size="2">>> command </font><br /><font size="2">>> (send "unregister YourEmailAddressHere" to </font><br /><font size="2">>> majordomo@postgresql.org)</font><br/><font size="2">>> </font><p><font size="2">-----BEGIN PGP SIGNATURE-----</font><br/><font size="2">Version: PGPfreeware 6.5.3 for non-commercial use <<a href="http://www.pgp.com"target="_blank">http://www.pgp.com</a>></font><p><font size="2">iQA/AwUBOwKTsHympNV/C086EQLIAgCgo6Ypci5XK4iDsNSEzxf5o2XCnLcAoLUd</font><br/><font size="2">4qdproc00iw/9aAiVdwQBqm7</font><br/><font size="2">=cgTO</font><br /><font size="2">-----END PGP SIGNATURE-----</font><code><fontsize="3"><br /><br /> _________________________________________________________________________<br/> This e-mail and any attachments are confidentialand may also be privileged and/or copyright <br /> material of Intec Telecom Systems PLC (or its affiliated companies).If you are not an <br /> intended or authorised recipient of this e-mail or have received it in error, pleasedelete <br /> it immediately and notify the sender by e-mail. In such a case, reading, reproducing, <br /> printingor further dissemination of this e-mail is strictly prohibited and may be unlawful. <br /> Intec Telecom SystemsPLC. does not represent or warrant that an attachment hereto is free <br /> from computer viruses or other defects.The opinions expressed in this e-mail and any <br /> attachments may be those of the author and are not necessarilythose of Intec Telecom <br /> Systems PLC. <br /><br /> This footnote also confirms that this email message hasbeen swept by<br /> MIMEsweeper for the presence of computer viruses. <br /> __________________________________________________________________________<br/></font></code>