Test sub queries