Count each unique category within one field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LThomas1940
    New Member
    • May 2013
    • 1

    Count each unique category within one field

    Expr1: (SELECT DISTINCT T1.[Rating Choice]
    FROM [Bear Gun Results] AS T1)



    I'm trying to count each unique category within one field.

    EX:

    Good
    Good
    Good
    Excellent
    Poor
    Poor

    The final output should be:

    Good = 3
    Excellent = 1
    Poor = 2
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You can use a basic aggregate query.
    Code:
    SELECT field, COUNT(*)
    FROM table
    GROUP BY field

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32653

      #3
      You seemed to be trying to fit both required values into a single output field. While that is possible, it isn't done that way.

      Rabbit has illustrated the correct approach for you. This query will return both values for each distinct value from [Rating Choice].

      Comment

      Working...