Count records in query by most records

L

larpup

I need to create a query that will count the (3) most records (of same
value) in that query? The Example below should return Anaheim, Azusa
and Hollywood. Not Los Angeles and Burbank.

Anaheim
Anaheim
Anaheim
Anaheim
Anaheim
Los Angeles
Los Angeles
Los Angeles
Azusa
Azusa
Azusa
Azusa
Azusa
Azusa
Azusa
Azusa
Burbank
Hollywood
Hollywood
Hollywood
Hollywood
Hollywood
Hollywood

Any assistance is appreciated.

Lar
 
K

Ken Sheridan

Lar:

Try this:

SELECT DISTINCT Place
FROM Places
WHERE Place IN
(SELECT TOP 3 Place
FROM (SELECT Place,COUNT(*) AS PlaceCount
FROM Places
GROUP BY Place)
ORDER BY PlaceCount DESC);

Ken Sheridan
Stafford, England
 
Top