Re: SQL query question

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: SQL query question
Дата
Msg-id 20060618100715.GB29167@wolff.to
обсуждение исходный текст
Ответ на SQL query question  (Kevin Jenkins <gameprogrammer@rakkar.org>)
Ответы Re: SQL query question  ("Gurjeet Singh" <singh.gurjeet@gmail.com>)
Список pgsql-general
On Sat, Jun 17, 2006 at 16:50:59 -0700,
  Kevin Jenkins <gameprogrammer@rakkar.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
;

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: SQL query question
Следующее
От: "Marco Bizzarri"
Дата:
Сообщение: Re: MySQL insert() and instr() equiv