how to limit number of records returned?

Results 1 to 2 of 2

Thread: how to limit number of records returned?

  1. #1
    Join Date
    Dec 1969
    Posts
    199

    Default how to limit number of records returned?

    Hi,<BR><BR>How can I write a SQL query such that it only returns the first<BR>3 records that matches the search criteria?<BR><BR>e.g a query that returns me the first 3 persons that have got<BR>age &#062; 20?<BR><BR>Thanks!

  2. #2
    Nathen Grass Guest

    Default RE: how to limit number of records returned?

    If you&#039re using SQL Server use SET ROWCOUNT 3 before your query.<BR>(i.e. SET ROWCOUNT 3 SELECT Person FROM Persons WHERE AGE &#062; 20)<BR><BR>If you&#039re using Access use SELECT TOP 3 (i.e. SELECT TOP 3 Person FROM Persons WHERE AGE &#062; 20)

Posting Permissions

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