Yet another Count, Distinct, Access question!
Question:
Imagine if you will a table like this:
letter number
A 1
A 2
A 2
A 2
A 3
A 3
B 1
B 1
B 1
I want to query this table for unique combinations of the two columns and then give me a count on each one. The results must look like this:
A1 1
A2 3
A3 2
B1 3
My statement currently looks like this:
SELECT DISTINCT (letter + number) AS unode
FROM nodes;
This gives me a list of unique combinations but I now need to incorporate an additional column with the count.
Thanks in advance for your help.
Solution:
Well, save the query you wrote:
SELECT DISTINCT (letter + number) AS unode
FROM nodes;
Then use matthewspatrick’s code except instead of selecting from “nodes”, you will select from whatever you named the above query.
So say you save the query above as qryDistinctNodes.
Select Count(*)
From qryDistinctNodes;
Thanks.













Comments (0)
Trackbacks - Pingbacks (0)
Leave a Reply