发布网友 发布时间:2022-04-26 09:57
共1个回答
热心网友 时间:2022-04-10 23:22
Select name,追问如果month 是一个区间呢 比如大于10 小于11月
追答Select name,
sum(case when month between '2016-10-01' and '2016-10-31' then money else 0 end) month10,
sum(case when month between '2016-11-01' and '2016-11-30' then money else 0 end) month11
from t
group by name
order by name