Remove Subquery, schema change and remove Distinct