I have no idea what this even means.<p>Try asking on <a href="http://dba.stackexchange.com" rel="nofollow">http://dba.stackexchange.com</a> if this is a database administration question, or on <a href="http://stackoverflow.com" rel="nofollow">http://stackoverflow.com</a> if it is a programming question.
I am not sure if I get your question.
I think this query should work<p>"select country, state, city, SUM(sales), SUM(profit) from foo group by country, state, city with rollup;"<p>for a table with country, state, city, sales, profit as columns