Merging of view/subquery with the outer query