Counting records

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Is there a way to count only one instance of a record? So
If I have the same ID 3 times in the same table I want a
count of one and a sum of 3.
Data looks like this;

Name Contact ID
John 35434
John 35434
John 35434
Mary 55555

Group by query

Name Contact ID SUM Contact
John 1 3
Mary 1 1

Thanks!
 
Does the ContactID uniquely determine the name?

If that the case, the second Column of your result is always 1, isn't it?

Perhaps your are not posting the full details ...
 
try

SELECT PersonName, Count(ContactID) AS CountOfContactID
FROM MyTableName
GROUP BY PersonName;

btw, i hope you don't have a field in your table called "Name". that's an
Access Reserved word, and will cause problems if you use it as a fieldname,
controlname, objectname, etc.

hth
 

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

Back
Top