Re: SQL query question

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Kevin Jenkins <gameprogrammer(at)rakkar(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL query question
Date: 2006-06-18 10:07:15
Message-ID: 20060618100715.GB29167@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jun 17, 2006 at 16:50:59 -0700,
Kevin Jenkins <gameprogrammer(at)rakkar(dot)org> 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
;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marco Bizzarri 2006-06-18 12:39:50 Re: MySQL insert() and instr() equiv
Previous Message Michael Glaesemann 2006-06-18 00:35:22 Re: SQL query question