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
 
Back
Top