Skip to content
Advertisement

Divide the results of two select queries

I have two SQL count queries that on their own work fine, they are:

Now how to do I add to the query to get the percentage of 26/130??

I have a new query to go along with how to get percentages.

Here it is:

this brings back results below:

If I remove the Distinct from my query there are obviously multiple rows for each level of progress. How do I add to the above distinct query to have a column at the end with the rate or percent of each level of progress compared to the overall number of lines?

Advertisement

Answer

You may use conditional aggregation and simple division in one query:

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