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

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

 



On Fri, Jan 14, 2011 at 5:30 PM, Kevin Grittner <Kevin.Grittner@xxxxxxxxxxxx> wrote:
SELECT y.*
 from (select a, max(revision) as revision
         from test where a between 2 and 200
         group by a) x
 join test y using (a, revision);

While certainly simpler than my temp table this really just exposes a flaw in my example - I'm really going to be doing this with an arbitrary list of As.

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

  Powered by Linux