Rewrites selections around join operators