MaxRecords or Top

Results 1 to 2 of 2

Thread: MaxRecords or Top

  1. #1
    Join Date
    Dec 1969

    Default MaxRecords or Top

    I have created a recordset based on user input. I then want to give the user the option to view the entire recordset or allow them to enter a number (X) to retrieve only (X) number of records. If I use "Select Top intRecords from TABLE" I get a error saying the word is reserved. Can someone help with the correct syntax?<BR><BR>Thank you!

  2. #2
    Join Date
    Dec 1969

    Default RE: MaxRecords or Top

    The TOP keyword is not supported by all databases... but, to use it, do:<BR><BR>SELECT TOP N columnlist<BR>FROM TableName<BR><BR>So,<BR><BR>SELECT TOP 10 Name, Age, Sex<BR>FROM TableName<BR>ORDER BY Age DESC<BR><BR>would get the 10 oldest people in the table...

Posting Permissions

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