GROUP BY, ORDER & LIMIT ?

Поиск
Список
Период
Сортировка
От Kynn Jones
Тема GROUP BY, ORDER & LIMIT ?
Дата
Msg-id c2350ba40805061022x3b487b59j63c7176ca065c19b@mail.gmail.com
обсуждение исходный текст
Ответы Re: GROUP BY, ORDER & LIMIT ?
Re: GROUP BY, ORDER & LIMIT ?
Список pgsql-general




Suppose table X has two columns: class (TEXT) and size (INT).  I want a listing showing the (up to) 5 largest values of "size" for each value of "class" (for some values of "class" the total number of available records may be less than 5).

What would be the simplest way to achieve such a listing?  It seems like something one could do with GROUP BY, ORDER, and LIMIT, but I can't figure out the right syntax for this query.

Thanks!

Kynn

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: more custom C function fun
Следующее
От: "David Wilson"
Дата:
Сообщение: Re: GROUP BY, ORDER & LIMIT ?