Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select a specific number of records 3

Status
Not open for further replies.

ooch1

MIS
Nov 4, 2003
190
GB
Hello,

Does anyone know if there is a function that will enable to choose the number of records i would like to rtrieve in a query???

I basically would like to select the top 1000 customers by revenue.

Ooch
 
Yes, there is...

it's been posted before somewhere in this forum...

search for FIRST or TOP or something like that...

Friday afternoon, too lazy to do it myself...
 
Try something like:

select top 1000 customers from strTable order by strRevenue

hope this gets you started
 
I basically would like to select the top 1000 customers by revenue
SELECT TOP 1000 customers,revenue FROM theTable ORDER BY revenue DESC;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
in the query properties: choose "top values" and write the number you want, in this case 1000
 
Thanks guys the top funtion worked a treat!!

Ooch.
 
Okay, if you had a query: - Select TOP 5 field1 FROM tbl -and there is more than five duplicate values in field1 (date, for example) it returns all of them (748, in my case)

How do you trunc the list at five? I only want the first five instances.
 
Select more columns

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top