Skip to content

Comment on Rollup for multiple fields in MySQL

Comments

I am not sure if I get your question. I think this query should work

"select country, state, city, SUM(sales), SUM(profit) from foo group by country, state, city with rollup;"

for a table with country, state, city, sales, profit as columns

Thanks. Had tried this way taking multiple fields but it didnt work. Will try again and update you. Once again thanks for the inputs, really appreciate

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.