hey guys, i dont suppose you know how i can go from:

id.............result
----------------------
1..............Pass
1..............Pass
1..............Fail
1..............Pass
1..............Fail
2..............Pass
2..............Pass
2..............Fail

to this table:

id...........pass......fail
1............3.........2
2............2.........1

my current query is simply

select id, result from results

I just want to display the total number of occurrences of a result and display them under appropriate headings...I tried performing a union on 2 separate select statements, but it just stacks results on top of one another...

thanks for any help

SELECT id, COUNT(NULLIF( result, 'Fail' )) Passes, COUNT(NULLIF( result, 'Pass' )) Fails
FROM results
GROUP BY id
ORDER BY id
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.