Re: Best way to get the latest revision from a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Shaun's example is a bit off: normally, when using DISTINCT ON, you want
> an ORDER BY key that uses all the given DISTINCT keys and then some
> more.  To get the max revision for each a/b combination it ought to be

Hah, well i figured I was doing something wrong. I just thought about it a little bit, said to myself: "Hey, I've used this before to get the most recent x for a bunch of y without a sub-query. We always used it to get the newest update to an event log.

But that's why I said I was probably misunderstanding something. :) I was trying to pick apart the logic to his temp tables and saw the max(b) and it threw me off. Glad you're around to set it straight. Heh.


______________________________________________

See  http://www.peak6.com/email_disclaimer.php
for terms and conditions related to this email

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux