Skip to content
Advertisement

Count of values grouped by a row id

My data looks like the below,

enter image description here

I want to sum up the count of occurrences of ALL. This should be grouped by Id. So the output should look like,

My query looks like,

This query is giving me the result as,

which is incorrect for Id 2. The value for Friday for the second row is an empty string.

dbfiddle

Advertisement

Answer

You can use counting for all days of a week with case being equal to ALL

Demo

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