Difficult Query: is this possible in SQL?

Original text of this message