'How can I find duration for particular instance was running as shown. I need to find time for which the instance was running

[data screenshot][1]

For example, instance 1 was started on 01/01/2021 and stopped on 06/01/2021, so it should return duration for how long particular instance was running in total in two columns instance_id and duration for which instance was running using mysql [1]: https://i.stack.imgur.com/sM0p2.png



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source