I have two tables, one that looks like this:
The other has the countries’ populations:
I would like to sum up the revenue by country (I know how to do this part, e.g Select Sum(Revenue), Country from COMPANIES GROUP BY Country;
)
and then divide it by the population from the other table to get per capital revenue , so the final result should be
2
Answers
That will be enough to get what you need (make sure that the Revenue column is not only an integer).
If you have this set:
sql_mode=only_full_group_by
Then it will need to be like this: