pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Restricting number of entries returned 2+ messages / 2 participants [nested] [flat]
* Restricting number of entries returned @ 1998-07-15 19:41 Neil Burrows <neil@remo.demon.co.uk> 0 siblings, 1 reply; 2+ messages in thread From: Neil Burrows @ 1998-07-15 19:41 UTC (permalink / raw) To: pgsql-sql 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? Thanks in advance, See ya, Neil Burrows /~\ /~\ /~~~~\ E-Mail - neil@remo.demon.co.uk | \| | | () / - nburrows@cs.strath.ac.uk | |\ | | () \ PGP Key - http://www.remo.demon.co.uk/pgp/ \_/ \_/ \____/ Internet - http://www.remo.demon.co.uk/ ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] Restricting number of entries returned @ 1998-07-15 22:06 Zsolt Varga <redax@agria.hu> parent: Neil Burrows <neil@remo.demon.co.uk> 0 siblings, 0 replies; 2+ messages in thread From: Zsolt Varga @ 1998-07-15 22:06 UTC (permalink / raw) To: Neil Burrows <neil@remo.demon.co.uk>; +Cc: 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/ | `----------------------------------------------------------' ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1998-07-15 22:06 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 1998-07-15 19:41 Restricting number of entries returned Neil Burrows <neil@remo.demon.co.uk> 1998-07-15 22:06 ` Zsolt Varga <redax@agria.hu>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox