dynamic subqueries - chains