Search Postgresql Archives

Re: SQL query question

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

 



On Sat, Jun 17, 2006 at 16:50:59 -0700,
  Kevin Jenkins <gameprogrammer@xxxxxxxxxx> wrote:
>  For example
> 
> filename date     revision
> file1    10/05/06 1
> file1    10/05/07 2
> file2    10/05/08 1
> 
> I want to do a query that will return the greatest date for each 
> unique filename

If the revisions for a filename are guarenteed to be ordered by date, then
another alternative for you would be:

SELECT filename, max(modificationDate), max(revision)
  FROM FileVersionHistory
  GROUP BY filename
;


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux