I'm answering
this - my previous answer isn't great - and the fiddle is PostgreSQL - couldn't get the Oracle one to work - I think I have what I need now. Have a
way better answer using window functions - but it required me getting to grips with window frames - not my forte! Spent all day on this - but I learnt a shedload!