${if(门店=="all"," SELECT c.fd_product_id, sum( a.fd_quantity )销量, count( DISTINCT a.fd_arko_order_id )订单数量, sum( a.fd_final_amount ) 销售额, sum( a.fd_gross_profit )毛利额 FROM `qyt02`.`arko_pos` a INNER JOIN `qyt02`.`arko_dim_channel` b ON a.fd_arko_channel_id = b.fd_arko_channel_id INNER JOIN `qyt02`.`arko_dim_product` c ON a.fd_arko_product_id = c.fd_arko_product_id WHERE 1=1 if(len(商品名称)==0,'','and c.fd_product_id in ('"+商品名称+"')')
AND a.fd_order_date_skid >= replace('"+开始日期+"','-','') AND a.fd_order_date_skid <= replace('"+结束日期+"','-','') GROUP BY c.fd_product_id
"," ")} |