Skip to content
Advertisement

How can I get the division of two group by on SQL?

I’ve seen several posts to get the percentage of each row (using partition by), others about getting one row divided by another (using inner join with the same table), but I haven’t seem this problem, so I hope this post is not a problem.

I have the following table:

And I want to get the percentage of IDs in group A. The result should be like this:

This should be pretty simple. But I got this far:

This doesn’t solve my problem.

Any thoughts?

Thanks in advance

Advertisement

Answer

You can use this (based on your latest edit) –

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