Skip to content
Advertisement

How to construct SQL query to get the output as below

the below image is how the table related and the expected output result.

enter image description here

I used MySQL version 6.3.3. and the below is currently can be achieved.

enter image description here

and below is the SQL query code

Anyone can help me to improvise the SQL query code above to get the expected output is very appreciated and thank you very much…

Advertisement

Answer

you can use ROLLUP functionality

And here is the super simple query:

see the live demo

read more about group by and rollup

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement