| 12345 |
- SELECT sum(t2.amount) amount, DATE_FORMAT(t1.checkdate, '%Y-%m') ym
- from sa_order t1
- INNER JOIN sa_orderitems t2 ON t2.sa_orderid = t1.sa_orderid and t2.siteid = t1.siteid
- WHERE t1.siteid = $siteid$ and t1.`status` in ('审核', '关闭') and YEAR (t1.checkdate) in ($year$, $befyear$) and t1.sa_agentsid =$sa_agentsid$
- GROUP BY DATE_FORMAT(t1.checkdate, '%Y-%m')
|