DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: maxdata

  1. #1
    Join Date
    Aug 2003
    Location
    Lucknow
    Posts
    8

    maxdata

    hi all,

    there is a table in which there is one column whose datatype is numeric. in this there are 300 rows. i want 250th maximum value of that table. how we can get it.

    bye
    thanks

  2. #2
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317
    I would suggest you read the chapter on RANKING in SELECT-statements. With that clause you can rank your data. After that it's easy to filter out the 250th value.

    HTH,
    Erik
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  3. #3
    Join Date
    Jun 2000
    Posts
    295
    Here is an example (if your Oracle is 8.1.6 or above)

    create table t as select rownum c from dba_objects
    where rownum <=300;

    select c from (
    select c, rank() over (order by c) r from t)
    where r=250
    /


    C
    ----------
    250

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width