'Devide two tables with a GROUP BY (SQL)

I have two tables. Table A counts all athletes with Gold Medal GROUP BY sex and country. Table A - counts the golds medals Table B count all athletes (without a WHERE clause). Table B - counts all athletes

I want the percentage of gold medals wins per sex per country (count_golds/count).

But when i devide this happens: (It devides males_golds/males total, males_golds/females_total, females_golds/males_total, females_golds/females_total) my code and the error

What GROUP BY needs to do only males_golds/males_total and females_gold/females_total



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source