Results 1 to 5 of 5

Thread: Select first 10

  1. #1
    Join Date
    Oct 2002
    Posts
    7

    Unanswered: Select first 10

    Say I have a query which displays 100 records.
    Is there any way (within Access 97) that I can alter the SQL to select only the first 10 after ordering in descending order.

    That way I can display the top 10 articles in table article by rating.

    I'm using ASP to execute these stored Access sql queries and I know I can display only the first 10 using ASP but I would rather all the selection processing went on within access.

  2. #2
    Join Date
    Oct 2001
    Location
    Chicago
    Posts
    440
    SELECT TOP 10 Table_t.Articles
    FROM Table_t
    ORDER BY Table_t.Articles;

    Matt

  3. #3
    Join Date
    Oct 2002
    Posts
    7
    Thanks, Didnt notice that drop box at the top of the QBE design view. Doh!
    Any way to show a range of records?
    EG: 100 records and I want to select 50 of them using criteria, order by desc and show records 11-20, or something along those lines.

  4. #4
    Join Date
    Oct 2001
    Location
    Chicago
    Posts
    440
    this may help:

    http://www.aspwebpro.com/aspscripts/...rdsperpage.asp

    or just search the web and you should find many more example for asp

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    You can also nest your top X selects. So for example:

    select * from (select top 10, * from (select top 20, * from table order by field1) order by field1desc) order by field1

Posting Permissions

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