protected override Expression VisitSelect(SelectExpression select)
        {
            select = (SelectExpression)base.VisitSelect(select);
            List <SelectExpression> selectsToRemove = RedundantSubqueryGatherer.Gather(select.From);

            if (selectsToRemove != null)
            {
                select = SubqueryRemover.Remove(select, selectsToRemove);
            }
            return(select);
        }
 protected override Expression VisitProjection(ProjectionExpression proj)
 {
     proj = (ProjectionExpression)base.VisitProjection(proj);
     if (proj.Select.From is SelectExpression)
     {
         List <SelectExpression> selectsToRemove = RedundantSubqueryGatherer.Gather(proj.Select);
         if (selectsToRemove != null)
         {
             proj = SubqueryRemover.Remove(proj, selectsToRemove);
         }
     }
     return(proj);
 }