• Thanks for the tip. I've actually recently purchased "Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions" written by Itzik Ben-Gan.

    I think the main problem is the data set doesn't have a predictable Window to partition against, so I can't use Window Functions w/o have a way to traverse the data.

    I'm working on a query using recursive CTE and LEAD/LAG. Looking at using a CROSS APPLY or FOR XML subqueries to generate the "Window"

    I might break down and write a procedural solution. Still really want this as a single query.