Skip to content
Advertisement

Is there a SQL command to return a count of an item with a WHERE and then the overall total?

I have the following statement:

This returns me:

How can I also return the total count of this part?

My goal is to create a table like this:

Thanks

Advertisement

Answer

A SUM case statement will do the trick:

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