• And the DDL and data has nothing like any of the queries you attempted - columns and tables aren't the same. Just setting it up won't work in SQL Server and interestingly enough, it won't work in Oracle either. I did some changes to get the table created and insert the data but your two queries together appear to be a sequence of things. And I won't download spreadsheets so not much more I can do on my end.

    Sue