Cognizant interview question

Using a subquery for a tough application.