473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
May 3 '13 #1
2 1277
Rabbit
12,516 Expert Mod 8TB
You can use a basic aggregate query.
Expand|Select|Wrap|Line Numbers
  1. SELECT field, COUNT(*)
  2. FROM table
  3. GROUP BY field
May 3 '13 #2
NeoPa
32,556 Expert Mod 16PB
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].
May 10 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Terri | last post by:
I have a form with a multi-select combo. I dynamically build a SELECT statement, open a report, and set the recordsource to my dynamic SELECT statement. I count the records returned in the report...
4
by: misscrf | last post by:
On a main form, there is a subform. I want to make a field that will show how many records there are within that subform. Count on the pk, where the subform's fk = the main form pk.. or something...
3
by: Mihir | last post by:
All, I have this table: ClientName City Ram Mumbai Ram Cochin Ram Mumbai Ram Bangalore Lakhan Mumbai
0
by: simonjackson500 | last post by:
I have a field as follows: aa_comp 03, 04, 05 03, 07, 05, 20 03, 06, 07 It is imported from xml (along with other fields), and I am aware of multiple values in a field is bad normalisation.
1
newnewbie
by: newnewbie | last post by:
Desperately need help in creating a query to count unique values in a table. I am a Business analyst with limited knowledge of Access….My boss got me ODBC connection to the underlying tables for our...
1
by: muld | last post by:
I've inherited a database system designed to calculate sickness absence statistics. There is a main table with an employee ID which also holds the number of days worked by that person in a year ....
0
denny1824
by: denny1824 | last post by:
I have a crystal report that someone else wrote and already has a Formula Field if Criteria then (Count ({FirstField},{SecondField}) / Count ({FirstField})) When the Criteria is true, this...
1
by: dez5000 | last post by:
I'm trying to get a report by location that would list the number of visits to the location for the month but also count the number of unique visitors to that location. I have a table of data with...
3
by: Dan Soendergaard | last post by:
Hi all, I'm sure there is a simple solution to this problem, although it sounds rather complex. I have an array of Entry objects with the fields: ip, date (unix time), name. So, the array might...
1
newnewbie
by: newnewbie | last post by:
Hi, Could somebody please help me with VBA code to count unique values in a Report? Report is based on a query that has grouped values. Basically, I would like to use formula...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.