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

Querying single table for multiple summaries - how?

Folks,

While I still have some hair left, can someone help me with this
query?

I have a table "TestRunInfo". Amongst other fields there are
"TestRunIndex" (Pri Key), "TesterID", "Duration", and "Status".

The Status field links to a Status table, which links the index value
to a more meaningful label "Pass", "Fail" etc...

As you may have guessed, there is a record for each test that an
individual tester runs, and with that record is a duration, and status
(1,2,3 etc).

What Im trying to do, is create a datasheet view, with a single row
for each testerID, summarising that Testers work as follows:

TesterID, Total Duration, Count of passed tests, Count of failed tests

So far I have:

Select TesterID, sum(Duration), count(Status) FROM TestRunInfo GROUP
BY TesterID

But this of course purely gives the total number of tests run by that
engineer as the count. I need to break it down. Help? Someone?
Please?!?!?

TIA

Steve
Jul 20 '05 #1
2 1385
Select TesterID, sum(Duration),
sum(case status when 1 then 1 else 0 end ) as st1 ,
sum(case status when 2 then 1 else 0 end ) as st2 ,
sum(case status when 3 then 1 else 0 end ) as st3
FROM TestRunInfo GROUP
BY TesterID

--
Strider
Jul 20 '05 #2
"strider5" <st******@s.zm.com> wrote in message news:<ci**********@domitilla.aioe.org>...
Select TesterID, sum(Duration),
sum(case status when 1 then 1 else 0 end ) as st1 ,
sum(case status when 2 then 1 else 0 end ) as st2 ,
sum(case status when 3 then 1 else 0 end ) as st3
FROM TestRunInfo GROUP
BY TesterID


Thanks Strider - that worked a treat. Didnt work quite so well as a
query in MS Access (Microsoft provide two "compatible" products?
Never...)... but it certainly put me on the right line, and I soon had
an Access equivalent (iif) up and running!

Cheers

Steve
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Greg | last post by:
I am working on a project that will have about 500,000 records in an XML document. This document will need to be queried with XPath, and records will need to be updated. I was thinking about...
5
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to...
1
by: Ken | last post by:
Help! I have a MS Access database made up of a single table. The data updates for this database comes in the form of a single Excel spreadsheet, which is imported into the database table. I...
0
by: rayone | last post by:
Hi folks. I need advice. 2 options, which do you think is the better option to display/retrieve/report on the data. Keep in mind reporting (Crystal), SQL Performance, VB Code, usability,...
7
by: bclegg | last post by:
Hi, I have a Monitoring application that needs to output single line summaries to a local dot matrix printer loaded with line flow. ie. It will have exclusive use of the printer which is connected...
6
by: dBNovice | last post by:
Hello All, I have a DB that have 6 tables - tblCreator, tblSummary, tblPaper, tblProposition, tblContributor, tblPanel. The tables are linked in the following way: tblSummary is linked with...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
4
by: Matt Kruse | last post by:
While developing an internal IE6-only webapp, a discussion started about the 'best' way to apply classes to data tables across multiple pages. The two arguments were: 1. Apply a single class to...
4
by: Takeadoe | last post by:
Dear NGs, I recently downloaded and read a bunch of material on normalizing your data and db design. Things aren't crystal clear yet! Part of the problem is that nearly every thing I read...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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

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.