By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,401 Members | 814 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,401 IT Pros & Developers. It's quick & easy.

Counting in Query

P: n/a
My data looks like:
Model: SerialNu. Failure: Problem: Correction:
T50 343X4 34 Cooler Repair
T55 85B10 34 Downline Replace
T50 345F2 34 Cooler Repair
T50 322A6 19 Pump Replace
T55 84A45 34 Cooler Repair

My query for Failure comes out like this:
34 Cooler Repair
34 Cooler Repair
34 Cooler Repair
34 Downline Replace

Which is okay, the techs can see that the cooler causes failure 34 more that
the Downline.

I would like the query to COUNT the records:
34 Cooler Repair 3
34 Downline Replace 1

Any ideas?

Email okay.

Thanks

Alan
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You need a group by query. It will be something like this:

SELECT Failure, Problem, Correction, Count(*) As Total
FROM MyDataTable
GROUP By Failure, Problem, Correction

--
Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast
"AAMoy" <aa***@aol.com> wrote ...
My data looks like:
Model: SerialNu. Failure: Problem: Correction:
T50 343X4 34 Cooler Repair
T55 85B10 34 Downline Replace
T50 345F2 34 Cooler Repair
T50 322A6 19 Pump Replace
T55 84A45 34 Cooler Repair

My query for Failure comes out like this:
34 Cooler Repair
34 Cooler Repair
34 Cooler Repair
34 Downline Replace

Which is okay, the techs can see that the cooler causes failure 34 more that
the Downline.

I would like the query to COUNT the records:
34 Cooler Repair 3
34 Downline Replace 1

Any ideas?

Email okay.

Thanks

Alan

Nov 12 '05 #2

P: n/a

Użytkownik "AAMoy" <aa***@aol.com> napisał w wiadomo¶ci
news:20***************************@mb-m15.aol.com...
My data looks like:
Model: SerialNu. Failure: Problem: Correction:
T50 343X4 34 Cooler Repair
T55 85B10 34 Downline Replace
T50 345F2 34 Cooler Repair
T50 322A6 19 Pump Replace
T55 84A45 34 Cooler Repair

My query for Failure comes out like this:
34 Cooler Repair
34 Cooler Repair
34 Cooler Repair
34 Downline Replace

Which is okay, the techs can see that the cooler causes failure 34 more that the Downline.

I would like the query to COUNT the records:
34 Cooler Repair 3
34 Downline Replace 1

Hi!

I'm not exactly surre if it'll work, but you may try this:

select [Failure], [Problem], [Correction], Count([Problem]) as 'Number of
problems'
from Your_Table
group by [Problem], [Failure], [Correction]

Regards, Leon!
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.