Skip to content
Advertisement

Create new date ranges from overlapping date ranges and assign an ID

I have the following table

I want to convert this table into a consolidated table which will look for overlapping date ranges and then combine these into new rows. Creating a non-overlapping set of date ranges.

The bit that I need the most help with is the consolidations of the ‘feature’ column which will concatenate each feature into the format below.

I’ve used the following to create the test data.

Advertisement

Answer

You can use apply :

Here is a db<>fiddle.

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