Selecect Top 5 Columns.with most Records

  • Thread starter Thread starter orbojeff
  • Start date Start date
O

orbojeff

I have a list table of names and address: tbl_DATA
I would like to create a query to return the top 5 CITIES with the most
records.
Also I would like to create a report and output the total number of
records

Thanks
Jeff
 
Dear Jeff:

The queries would look something like this:

SELECT TOP 5 CityName, COUNT(*) CityCount
FROM YourTable
GROUP BY CityName
ORDER BY COUNT(*) DESC

SELECT COUNT(*) TotalCities
FROM YourTable

Tom Ellison
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top