prepare subquery support