select format(DateSerial(year(a.月份), Month(a.月份), 1),'yyyy-m月') as 日期,
max(a.能耗)-(select max(b.能耗) from 表1 as b where DateSerial(year(a.月份), Month(a.月份), 1)=DateSerial(year(b.月份), 1+Month(b.月份), 1)) as 结果
from 表1 as a
where format(a.月份,'yyyy-m')<>(select format(min(月份),'yyyy-m') from 表1) group by DateSerial(year(a.月份), Month(a.月份), 1)
周义坤回复的
select format(DateSerial(year(a.月份), Month(a.月份), 1),'yyyy-m月') as 日期,
max(a.能耗)-(select max(b.能耗) from 表1 as b where DateSerial(year(a.月份), Month(a.月份), 1)=DateSerial(year(b.月份), 1+Month(b.月份), 1)) as 结果
from 表1 as a
where format(a.月份,'yyyy-m')<>(select format(min(月份),'yyyy-m') from 表1) group by DateSerial(year(a.月份), Month(a.月份), 1)