Skip to content
Advertisement

How to filter and count percentages and count in SQL

After a query I end up with a table like this tbl_1:

I would like to calculate the total_count by category, and the percentage of count that is not (type<>'v') also by category in SQL.

Any ideas how I could do that ?

The resulting table should look like this:

Advertisement

Answer

Is this what you want?

From the original table, you could just do:

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