• This was a problem originally posted in one of the SQL server forums. That gives me an indication that there may be places when this type of queries are used.

    Some of the challenges that we present through the 'TSQL challenges' series are taken from real-life scenarios and some are not. The goal is not only to solve the problem, but also to exercise and enhance the query writing skills and SET based thinking.

    .