SQl Statement for first 1000 records
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: SQl Statement for first 1000 records

  1. #1
    Join Date
    Nov 2002
    Location
    hydreabad
    Posts
    34

    SQl Statement for first 1000 records

    Hi,
    I have one account table it has more than 10,00,000 records.
    But i have to show the first 1000 recods.
    What is equlalent query in oracle?
    In SQL Server: select TOP 1000 * from Account order by Account_id;

    If i used the RowNUm in Oracle but order caluse is ging offf
    Pl help for this query

    Thanks & regards
    Prasad kVV
    Venkata vara Prasad Kosaraju

  2. #2
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Code:
    Select 
      * 
    From 
      (
       Select 
         * 
       From 
         My_Table 
       Order By 
         My_Col
      ) 
    Where 
      Rownum < 1001
    ;
    Abhay.
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  3. #3
    Join Date
    Nov 2002
    Location
    hydreabad
    Posts
    34
    Thanks Abhay it is working.
    Any Other solution it would work for both Oracle and sql server databses?
    Venkata vara Prasad Kosaraju

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