From: | "Michael Ansley (UK)" <Michael(dot)Ansley(at)intec-telecom-systems(dot)com> |
---|---|
To: | "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Marc Sherman <msherman(at)projectile(dot)ca> |
Cc: | pgsql-sql List <pgsql-sql(at)postgresql(dot)org> |
Subject: | RE: Select most recent record? |
Date: | 2001-05-16 14:50:38 |
Message-ID: | 7F124BC48D56D411812500D0B747251480F594@fileserver002.intecsystems.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
-----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(at)sss(dot)pgh(dot)pa(dot)us]
>> Sent: 16 May 2001 15:36
>> To: Marc Sherman
>> Cc: pgsql-sql List
>> Subject: Re: [SQL] Select most recent record?
>>
>>
>> "Marc Sherman" <msherman(at)projectile(dot)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(at)postgresql(dot)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-----
From | Date | Subject | |
---|---|---|---|
Next Message | Marc Sherman | 2001-05-16 14:52:31 | RE: Select most recent record? |
Previous Message | Tom Lane | 2001-05-16 14:50:17 | Re: Select most recent record? |