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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query for top ten

Status
Not open for further replies.

dcorrea

IS-IT--Management
Aug 15, 2002
22
US
I have a list of hospitals with totals for each hospital in one table. I need to know how to setup a query to retrieve the top 10 totals for each hospital on this one query.

Thanks,
 
to be more specific if the name is Hospitaltotal then

try something like this

SELECT TOP 10 Hospitaltotal FROM tablename

-VJ
 
Thanks for the quick reply VJ. How would I do it if I wanted the top 10 results for more than one hospital in this query?

Example:
Hospitals - A, B, C... have 20 different numerical entries each, recorded in this one table (tblHospitalTotals).

I am needing to retrieve the top 10 entries (greatest numerical entries) for each hospital.

Thanks again,

Danny
 
Ok then try this:

SELECT TOP 10 FROM Tablename Group By HospitalName

Hope this helps

VJ
 
Danny,

Sorry, my mistake. The previous wont work.

-VJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top