Meta interview question

SQL problem with case statements and joins