| From: | Zsolt Varga <redax(at)agria(dot)hu> |
|---|---|
| To: | Neil Burrows <neil(at)remo(dot)demon(dot)co(dot)uk> |
| Cc: | pgsql-sql(at)postgreSQL(dot)org |
| Subject: | Re: [SQL] Restricting number of entries returned |
| Date: | 1998-07-15 22:06:38 |
| Message-ID: | Pine.LNX.3.96.980716000405.21940A-100000@lupus.agria.hu |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(at)agria(dot)hu |
| System Administrator | URL: http://www.agria.hu/ |
`----------------------------------------------------------'
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ounnapirak, Chotiwat | 1998-07-16 02:46:40 | RE: pgsql-sql-digest V1 #9 |
| Previous Message | Neil Burrows | 1998-07-15 19:41:44 | Restricting number of entries returned |