Calculating Unique Entries in Access Queries
Standard Access Count(*)
functions can't directly handle unique value counts. To accurately count distinct entries within a specific field, a modified query is required.
The following query demonstrates how to obtain a distinct count of the "Name" field from the "table1" table:
<code class="language-sql">SELECT Count(*) AS N FROM (SELECT DISTINCT Name FROM table1) AS T;</code>
This approach leverages a subquery to initially extract unique "Name" values. The outer query then counts the rows from this subquery's result set, yielding the correct unique count.
The above is the detailed content of How to Count Unique Values in an Access Query?. For more information, please follow other related articles on the PHP Chinese website!