Re: [SQL] Restricting number of entries returned

Поиск
Список
Период
Сортировка
От Zsolt Varga
Тема Re: [SQL] Restricting number of entries returned
Дата
Msg-id Pine.LNX.3.96.980716000405.21940A-100000@lupus.agria.hu
обсуждение исходный текст
Ответ на Restricting number of entries returned  ("Neil Burrows" <neil@remo.demon.co.uk>)
Список pgsql-sql
On Wed, 15 Jul 1998, Neil Burrows wrote:

|Hi,
|
|Is there any way of restricting the number or entries returned in an SQL
|query?
|
|For example, if you wanted to do a select that ordered the results by a
|certain field, and only wanted the "Top 10" entries, is there any way to
|specify that you just want the 1st 10 records?

I don't know is there any simple solution
but you can do it with cursors

begin;
declare curs01 cursor for select artist,music,vote from musicdb order by
  vote descending;
fetch 10 in curs01;
end;

    redax

.----------------------------------------------------------.
|Zsolt Varga            | tel/fax:   +36 36 422811         |
| AgriaComputer LTD     | email:     redax@agria.hu        |
| System Administrator  | URL:       http://www.agria.hu/  |
`----------------------------------------------------------'


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

Предыдущее
От: "Neil Burrows"
Дата:
Сообщение: Restricting number of entries returned
Следующее
От: "Ounnapirak, Chotiwat"
Дата:
Сообщение: RE: pgsql-sql-digest V1 #9