473,322 Members | 1,287 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,322 software developers and data experts.

Count of two different values in the same field

How do I go about doing a count on a column called BT for two different possible values? For example if

BT= 1
BT=2
BT=1
BT=2
BT=3
BT=1

How would I count the number of times BT=1 and BT=2?
Jun 25 '07 #1
2 2869
JKing
1,206 Expert 1GB
Try this:

This will return a count for each value in the table
Expand|Select|Wrap|Line Numbers
  1. SELECT BT, Count(BT)
  2. FROM tblTable
  3. GROUP BY BT
  4.  
If you only want to do it for specific values in the table use this:
Expand|Select|Wrap|Line Numbers
  1. SELECT BT, Count(BT)
  2. FROM tblTable
  3. WHERE BT In (1,2)
  4. GROUP BY BT
  5.  
Jun 25 '07 #2
Thanks for the reply.

Sorry I forgot to mention that I need the values to appear in their own column.


So if the number 1 appeard twice then I would need a column named Number of #1 Occurences with the value 2 and if the number 2 appeared 5 times then I would need a column named Number of #2 Occurences with the value 5.
Jun 25 '07 #3

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

Similar topics

5
by: Cro | last post by:
Hello Access Developers, I'd like to know if it is possible to perform a count in an expression that defines a control source. My report is based on a query. In my report, I want a text box to...
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.
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
1
by: jmarr02s | last post by:
I used the following query supplied by Jorn, SELECT IIf(=15 Or =19, "15 og 19",IIf(=13 Or =17,"13 og 17",IIf(=16 Or =20,"16 og 20",IIf(=14 Or =18,"14 og 18",IIf(=9, "9",...
2
by: Pete | last post by:
I need to create a single query (Not a SQL query) against a single table that counts the number of records in the table, where the single field "tmp" contains specific string values If the field...
1
by: dud10 | last post by:
Hi All, I´m having a problem with count of null values fields and indexes... I have a table (tb_Propose) with around 8 million lines. A field Dt_flag -- Datetime An index Ix_Dt_flag,...
5
by: Dean | last post by:
Hi, I have a table with non-unique identifiers. I need to take all the values with the same ID's and combine them into one field with a semicolon as a seperator. These values may exceed 255...
3
by: isoquin | last post by:
I've looked, and not found much. I have a text field in a form named , which acquires its data through a control source of =getLocation() the getLocation() function returns a DLookup, which...
14
by: zufie | last post by:
I have to create a QA report regarding callers calling into a phone hotline. The report consists of many checkboxes such as: Did the IBCCP agency contact you? Yes/NO How many days passed...
6
by: BeaBea | last post by:
Hi All, I am trying to set up a report based on a Select Query. I need to do a count based on four different fields. Field 1: Product Type (text field - 5 different products) Field 2: Claim...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.