select A1.month_date a1, A2.month_date a2 from ( select month_date from dc_market_vol_city_f where month_date >= convert(varchar(7),DATEADD(mm, -37, GETDATE()),120) and month_date <= convert(varchar(7),DATEADD(mm, -1, GETDATE()),120) ) A1 left join dc_market_vol_city_f A2 on months_between(convert(varchar(7),A1.month_date,120),convert(varchar(7),A2.month_date,120)) between 0 and 5
就是最后一句months_between函数改掉 |