Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
In the sample table below I need a script to return the last instance of event_type CP before the first instance of S. The primary comparison priority is the most recent event_date, and the secondary priority is event_id.In the event of duplicate dates the tie breaker will be the highest event_id.So the resulting table will be