赞
踩
create_time 分组月份的依据
deal_number 按照月份分组的金额
select Month(create_time) as 'Month'
, sum(deal_number) as 'Total Sales'
-- You can even add a count of loans at the same time.
, sum(case when deal_number <= 0 then 1 else 0 end) as 'Total Loans'
from pay_order
group by Month(create_time);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。