select
strftime('%Y-%m',a.订购日期) as ak,
count(a.订单ID) as ddsl,
sum(case when a.是否已付= 'true' then 1 else 0 end) as yfddsl,
sum(b.单价*b.数量) as yxl
from 订单 a
left join
订单明细 b
on a.订单ID =B.订单ID
where strftime('%Y',订购日期) ='${year}'
group by strftime('%Y-%m',订购日期)
order by ak asc
————————————————————————
