这是之前改好的: select ma.id,ma.title,ma.specification,sum(m.num*p.num) num,o.province,o.city from `order` o join order_product p on p.order_id=o.id join product_template t on p.item_template_id=t.id join product_material m on m.product_id=t.id join material ma on ma.id=m.material_id where o.created between UNIX_TIMESTAMP('${tstart1}') and UNIX_TIMESTAMP('${tend1}')+86400 and o.done_time between UNIX_TIMESTAMP('${pstart1}') and UNIX_TIMESTAMP('${pend1}')+86400 and o.pay_status=2 and o.status=99 /*and o.province="广东省" and o.city="深圳市"*/ /* where o.created > 1631281869 */ group by ma.id,ma.title,ma.specification,o.province,o.city; - - - 但是用户说希望既可以同时使用,又可以单独使用其中一个 |