Skip to content
Advertisement

calculate pass and fail count in sql/oracle

i have database table in oracle like,

i want output like this

Logic :-> if respective id&cycle any status is passed then its pass count 1 and if respective id&cycle all status is failed then fail count 1

can Anyone help here ?

Advertisement

Answer

You can use MIN and MAX aggregation functions to perform the equivalent of boolean logic for this query, using MAX to test if any status value is Passed, and MIN to check if any status value is not Failed:

Output:

Demo on dbfiddle

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement