Results 1 to 5 of 5
  1. #1
    DHIGHTO is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    30

    Counting unique values in a query

    Hey guys,



    I'm trying to get a count of unique or distinct values in a query. When I run sort-group by, I get unique values, but when I switch to count to sort, I'm getting a count of total count that includes duplicates. I'm trying to count the number of group by values (if that makes sense). Is there way to do this without writing it in SQL?

    Thanks,

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Can you explain your table structure and post some sample data with your expected result?

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    In an Aggregate Query; where you have a field that is Group By; repeat that field but change its mode to Count

  4. #4
    DHIGHTO is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    30
    Quote Originally Posted by JoeM View Post
    Can you explain your table structure and post some sample data with your expected result?
    I was able to get a count of group by when I created a query searching for group by and then created another query to count.This is what I got, which is close to correct. I have more duplicate data from another table I have to weed out, but I did find what I was looking for.
    EMP# CountOfTFILE
    101241 4
    101605 29
    105107 79
    105169 81
    107164 2
    108605 34
    109809 36
    116483 25

  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    As NTC pointed out, an Aggregate Query should do what you want, and weed out the duplicates.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 02-24-2014, 02:19 PM
  2. counting unique entries
    By Pastor Del in forum Queries
    Replies: 3
    Last Post: 01-12-2014, 02:55 AM
  3. Limiting Query Results to Unique Values
    By orangeman2003 in forum Queries
    Replies: 2
    Last Post: 12-25-2013, 01:08 PM
  4. Replies: 5
    Last Post: 02-29-2012, 11:56 AM
  5. Duplicate Query Reporting Unique Values...
    By Tomfernandez1 in forum Queries
    Replies: 5
    Last Post: 04-19-2011, 04:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums