Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL for top 100 values

Re: SQL for top 100 values

From: Ron Rogers <RROGERS_at_galottery.org>
Date: Thu, 10 Jan 2002 09:11:43 -0800
Message-ID: <F001.003EC8F9.20020110084207@fatcity.com>

Deen,
 You could try SELECT fields... FROM
(SELECT field1 FROM table1 ORDER BY field1) WHERE rownum > 100;  ( the value is 100 less that number of rows returned)
That will order the rows returned by the value in the field1 and then give you the row numbers of the returned rows that are greater than 100. Be sure to adjust the query to know how many rows are returned and then get only the last 100.Read about Top-N SQL Queries... ROR mª¿ªm>>> ddayal_at_dol.state.nj.us 01/10/02 11:03AM
>>>hi SQL wizards,Can any body help me with the tjis SQL. I
need a SQL records with top 100 values of a table ( not rownum < 101 ).ThanksDeen-- Please see the official ORACLE-L FAQ: http://www.orafaq.com-- Author: Deen
Dayal  INET: ddayal_at_dol.state.nj.usFat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051San Diego, California        -- Public Internet access / Mailing

Lists--------------------------------------------------------------------To 
REMOVE yourself from this mailing list, send an E-Mail messageto: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and inthe message BODY, include a line containing: UNSUB ORACLE-L(or the name of mailing list you want to be removed from).  You mayalso send the HELP command for other information (like subscribing). Received on Thu Jan 10 2002 - 11:11:43 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US