Database Question

M

Metalteck

I have to run a query that displays the most frequent results for a field. Is
there a way I can tell access to only pull the most frequent results from a
specified field?
 
J

John Vinson

I have to run a query that displays the most frequent results for a field. Is
there a way I can tell access to only pull the most frequent results from a
specified field?

Create a Totals query, grouping by the value of the field and counting
records; and sort by that count:

SELECT Fieldname, Count(*) AS Hits
FROM yourtable
GROUP BY Fieldname
ORDER BY Hits DESC;

You can also use the Top Values property of the query to return (say)
only the top ten hits.

John W. Vinson[MVP]
 
Top