[![DATA TABLE](https://i.stack.imgur.com/CEWHc.png)](https://i.stack.imgur.com/CEWHc.png)

I Have a table as above. How can I get an output (as shown below) with a single mysql query.

[![enter image description here](https://i.stack.imgur.com/q9TfY.png)](https://i.stack.imgur.com/q9TfY.png)