support outer_joins with sql code