Reputation: 191
I have "Result" column in my table. Result column contains one of the below three values, Pass, Fail, Incomplete. I need to write a query which gives below three results 1. total count of passed records 2. total count of failed records 3. total count of incomplete records
Is it possible? If yes, please guide me to write it. Thanks in advance.
Upvotes: 0
Views: 148
Reputation: 425301
SELECT COUNT(CASE result WHEN 'Pass' THEN 1 END) AS passed,
COUNT(CASE result WHEN 'Failed' THEN 1 END) AS failed,
COUNT(CASE result WHEN 'Incomplete' THEN 1 END) AS incomplete
FROM mytable
Upvotes: 1