Rollup for multiple fields in MySQL 4 points by sGrabber 13y ago ↗ HN I am able to run rollup for single field but unable to do for multiple fields in MySQL. Any idea how can we do rollup on multiple fields
[–] mooism2 13y ago ↗ I have no idea what this even means.Try asking on http://dba.stackexchange.com if this is a database administration question, or on http://stackoverflow.com if it is a programming question. [–] sGrabber 13y ago ↗ Thanks. I am looking it up at various places. Rollup is a db command [–] stevekemp 13y ago ↗ > rollup is a db commandYou need to read "How to ask questions the smart way".A quick google suggests "rollup" is used with grouped-queries, so it is a modifier to an SQL select operation, not a db-command as such. [–] sGrabber 13y ago ↗ Thanks for correcting
[–] sGrabber 13y ago ↗ Thanks. I am looking it up at various places. Rollup is a db command [–] stevekemp 13y ago ↗ > rollup is a db commandYou need to read "How to ask questions the smart way".A quick google suggests "rollup" is used with grouped-queries, so it is a modifier to an SQL select operation, not a db-command as such. [–] sGrabber 13y ago ↗ Thanks for correcting
[–] stevekemp 13y ago ↗ > rollup is a db commandYou need to read "How to ask questions the smart way".A quick google suggests "rollup" is used with grouped-queries, so it is a modifier to an SQL select operation, not a db-command as such. [–] sGrabber 13y ago ↗ Thanks for correcting
[–] lazyfunctor 13y ago ↗ 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 [–] sGrabber 13y ago ↗ 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
[–] sGrabber 13y ago ↗ 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
6 comments
[ 2.4 ms ] story [ 10.7 ms ] threadTry asking on http://dba.stackexchange.com if this is a database administration question, or on http://stackoverflow.com if it is a programming question.
You need to read "How to ask questions the smart way".
A quick google suggests "rollup" is used with grouped-queries, so it is a modifier to an SQL select operation, not a db-command as such.
"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