Home > Software engineering >  Access get a list and total count of distinct items
Access get a list and total count of distinct items

Time:08-08

I've been trying to find an Access version of the subject and testing many concepts. All I want to do is what I thought was simple. Let's say I have a single column in a table. Values are like

California Florida California California New York California New York

let's leave it that simple. All I'm trying to do which seems easy in SQL Server or Oracle is show the distinct values and how many times they are referenced in the table. So output would be:

California 4 Florida 1 New York 2

On Access 2019 if it matters.

CodePudding user response:

Standard SQL; would be the same in SQL-Server, Oracle, MsAccess (and almost all other SQL dialects); just use:

select State, count(*)
from YourTbl
group by State
  • Related