Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2003
    Posts
    1

    Unanswered: SELECT TOP 5 from TABLE in orcle???

    SELECT TOP 5 from TABLE. in orcle Possible?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    specific to oracle:

    select *
    from
    ( select foo, bar
    from table
    order by foo desc )
    where rownum <= 5

    works in any database:

    select foo, bar
    from thetable X
    where 5 >
    ( select count(*)
    from thetable
    where foo > X.foo )

    rudy
    http://rudy.ca/

Posting Permissions

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