how this query can be done?

Original text of this message