Avoid counting duplicated fields

P

Pietro

Hi,
In a query i want to count the field SR (formatted as number),but this
field my be repeated twice or three times,so I want to count every SR one
time only...
Can anybody help?
 
K

Ken Sheridan

Count the rows returned by a subquery using the SELECT DISTINCT option, e.g.

SELECT COUNT(*) AS SR_Count
FROM (SELECT DISTINCT SR
FROM YourTable) AS T1;

You'll find Access will change it a bit after you save it, changing the
parentheses to brackets and adding a dot after the subquery. It will work
just the same though.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top