Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query help - group with count criteria

Author  Topic 

andrewcw
Posting Yak Master

133 Posts

Posted - 2005-11-07 : 13:34:54
I cant seem to 'see' the syntax to formulate a query that will give me the ( count ) number of failure as grouped by a column. Column A represent step Numbers, B the status, C the attempt # - but its not important in this query, the count based on <> 'PASS' is.

A B C
205.1 FAIL 1
205.1 PASS 2
205.1 FAIL-Y 3
205.1 PASS 4
206.1 FAIL 1
206.1 FAIL-XYZ 2
206.1 FAIL 3
206.1 PASS 4

Number of not passed conditions per column A

205.1 2
206.1 3

Thanks very much !

andrewcw

nathans
Aged Yak Warrior

938 Posts

Posted - 2005-11-07 : 13:52:49
Id rather see a status_id in place of your 'FAIL-XYZ', etc... but you should be able to modify this query to do what you want:


select a, count(*) as 'fail_count'
from yourTable
where b like 'FAIL%'
group by a


Nathan Skerl
Go to Top of Page

andrewcw
Posting Yak Master

133 Posts

Posted - 2005-11-07 : 14:16:24
Thanks ! it works !

andrewcw
Go to Top of Page
   

- Advertisement -