MSCI interview question

SQL question on self join.