Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2007
    Posts
    6

    Unanswered: Can I prompt the user for a top results query?

    I know I can create a query for the top X amount of results...but can I prompt the user to choose how many top records there should be? Sometimes, its the top 3, sometimes 10 5, etc. Thanks.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yes, it's possible, but you cannot actually use the TOP keyword
    Code:
    select id
         , member
         , joindate
      from members X 
     where ( select count(*) 
               from members  
              where joindate > X.joindate ) < [ enter top number ]
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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