I was wondering how this Query can be written. I tried with Rank and Preceeding in SQL Server 2019 but could not come up with the result. I have the following table structure an