Skip to content
Advertisement

Creating a group by of a group by

I’m sure this is really straightforward, but I’m struggling! I’d like to create a group by for the count of the incidence of a value, eg. there are two incidences of case_id ’10’ and two of case_id ’20’, so there would be two counts of ‘two’

Data table:

Creates this:

Thank you!

Advertisement

Answer

Use an inner query:

Demo on DB Fiddle:

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