View Full Version : Count different names
Hello!
I have many names in column "Name". Now i want count different names in column "Name" :think:
Earlier using 2 queries. first group and second count but is any fastest way and using 1 query? :help
alimcpill
10-20-2005, 05:06 AM
Really you need COUNT(DISTINCT Name) but I don't think Access will let you do this. A nested query usually works, though the access sql editor sometimes does funny things with these queries after you save them.
SELECT COUNT(*) FROM
(
SELECT DISTINCT [fieldname] FROM [tablename]
)
You could also save the subquery as a query in its own right, so you could have
qryDistinctNames = 'SELECT DISTINCT [Name] FROM TableName'
and
qryDistinctNameCount = 'SELECT COUNT(*) FROM qryDistinctNames'
However, there's probably a nicer way of doing this, which I'm sure someone will tell us!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.