一、
select d.shop_id as shopId, sum(d.traffic_out_of_door) as humanFlow,
sum(d.in_store_flow) as inStoreFlow, sum(d.human_flow) as humanFlow, FORMAT(d.in_store_flow/d.human_flow,3) as inStoreRate , sum(new_customers) as newCustomers, sum(old_customers) as oldCustomers from t_stat_day d where d.shop_id in (4843, 4844, 4846, 4768, 4845, 4850, 4765) and d.stat_time >= '2017-04-01' and d.stat_time <= '2017-04-31'group by d.shop_id;
上面的sql查询到两条结果如下
:
二、
select d.shop_id as shopId, sum(d.traffic_out_of_door) as humanFlow, sum(d.in_store_flow) as inStoreFlow, sum(d.human_flow) as humanFlow, FORMAT(d.in_store_flow/d.human_flow,3) as inStoreRate , sum(new_customers) as newCustomers, sum(old_customers) as oldCustomers from t_stat_day d where d.shop_id in (4843, 4844, 4846, 4768, 4845, 4850, 4765) and d.stat_time >= '2017-04-01' and d.stat_time <= '2017-04-31' ;
上面的sql查到一条数据如下:
其中各项数据是第一个sql的结果之和。