Working on nested queries in query 1