restricting number of records returned in a query

D

David Gartrell

Hi there,

I wonder if someone can halp me please. I have a query that returns several
hundred rows but i'd like to restict the query to return only the first 30
rows out of the entire list. I was wondering if there's any way to do this
in SQL. I'd be very grateful for any help anyone could give.

Many thanks

David.
 
A

Allen Browne

Open your query in design view.
Open the Properties box (View menu.)
Beside the Top Values property, enter 30

Whatever sorting you have in your query, add the primary key field to the
end of it so there cannot be any "tie" in the sorting. If the 30th and 31st
records tie, you get 31 records returned, even though you only asked for 30.
 
Top