Skip to content
Advertisement

How to find overlapping time slices of serveral key-value elements

I would like to find out if I have overlapping time slices that have the same id and the same name. In the following example, the entries with id=2 and name=c overlaps. Entry with id=1 is just for demonstration of a good case.

Given table:

expected output:

Thanks for your help in advance!

Advertisement

Answer

You can get the overlapping rows using exists:

If you just want the id/name combinations:

You can also do this with a cumulative max:

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