How could we implement a SQL Flow that would split lines based on certain logic

Hello,

I have an ask where I need to split lines when there are multiple Users working at the same time in order to accurately count how many users are working together during a certain interval.

If I have 3 users working each one during different periods I want to split the Initial rows as per below picture. If I am able to do this then I can accurately count how many users worked during a period.

For example, I can say that between 11.30 and 11.40 I had User 1 and User 3 working together.

I was trying to do this in a SQL Flow but given the fact that we cannot use CTEs nor Cursors in MYSQL 5.6 I was wondering if someone else would have an idea on how to do this. It does not have to be done with Flows, it could be ETL or anything else as long as I get the splits in a new dataset that would work for me.

Thank you