ids from grouped rows

Поиск
Список
Период
Сортировка
От Lindsay
Тема ids from grouped rows
Дата
Msg-id e1f838770507200546208a47fc@mail.gmail.com
обсуждение исходный текст
Ответы Re: ids from grouped rows  (Ragnar Hafstað <gnari@simnet.is>)
Re: ids from grouped rows  (Weinzierl Stefan <Stefan@Weinzierl-Stefan.de>)
Список pgsql-sql
Lets say i do this:

SELECT name, MAX(age)
FROM Person
GROUP BY name

This will group people who have the same name together, and return the
highest age for each group. I want to be able to find the id for the
person with the highest age in each group  -

Ideally, it would be something like this

SELECT name, MAX(age), id_for_row_with_max_age
FROM Person
GROUP BY name

Anyone know how to do this?

Lindsay


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

Предыдущее
От: Andreas Joseph Krogh
Дата:
Сообщение: Re: echo/printf function in plpgsql
Следующее
От: Ragnar Hafstað
Дата:
Сообщение: Re: ids from grouped rows