lizhewenbei 发表于 2017-4-24 17:44 
比如用case when语句?
这个我感觉没有必要,因为麻烦很多,code如下:
select a.avgtemp,b.avgtemp from
(select province,year,avg(temperature) avgtemp from 表名
where month in (1,2,3)
group by province, year) a,
(select province,year,avg(temperature) avgtemp from 表名
group by province, year) b
where a.province=b.province and a.year=b.year
这个我也没有跑,你试试看,可能有的地方还需要调试