Hi, I have the following table: and I would like the following output: I would like any records where the service dates are between the first and last dates for each event number to also be populated with the same event number. For example, Event_no = 1 has a date range of 1st Jan 2020 to 3rd Jan 2020. I would like all records between those dates (inclusive) to be tagged as Event_no = 1. Then so on for Event_no = 2 etc. There will be hundreds of distinct Event_nos in the data. If it helps to populate by different means, the Event_nos are determined by the Code AAA occurring on consecutive days. Ie, Event_No 1 occurs on 1st, 2nd and 3rd of January 2020. I've tried a while loop but it seems to get stuck in an infinite loop, I'm not sure how to resolve. Any suggestions would be much appreciated. Many thanks!
... View more