SELECT
strftime('%Y-%m',订购日期) as 年月,
count(1) 订单数量,
count(case when 是否已付='true' then 1 else null end) as 已付订单数量,
sum(数量) 销量
FROM 订单 A left join 订单明细 B on A.订单ID=B.订单ID
where 1=1
${if(len(year)==0,"","and strftime('%Y',订购日期)='"+year+"'")}
group by
strftime('%Y-%m',订购日期)