David,
> If I were to do:
> SELECT nationality, ((COUNT(*) * 100)/(select count(*) from member)) as
> percentage FROM member GROUP BY nationality ORDER BY nationality;
>
> would this repeatedly execute the inner query over and over?
Yes, it would
Better is:
SELECT nationality, (COUNT(*)*100/total_members) as percentage
FROM member,
(SELECT COUNT(*) as total_members FROM members) tot_mem
GROUP BY nationality
ORDER BY nationality
This method runs the grand total only once.
--
Josh Berkus
Aglio Database Solutions
San Francisco