标签:_id enum order nbsp name group by date 获取 sum
select
p.sku_id as skuId,
p.sku_name as skuName,
p.sku_unit as skuUnit,
p.sku_price_unit as skuPriceUnit,
p.unit_price_num as unitPriceNum,
p.c1_id as c1Id,
p.c1_name as c1Name,
p.c2_id as c2Id,
p.c2_name as c2Name,
m.city_id as cityId,
d.warehouse_id as warehouseId,
d.delivery_date_type as deliveryDateType,
d.delivery_time as deliveryTime,
sum(p.num*p.unit_sku_num) as sales
from
t_pop_order_main m
left join t_pop_order_product p on m.id=p.order_id
left join t_pop_order_delivery d on m.delivery_id=d.id
where p.pop_id=1252
and p.sku_id in(533864)
and d.delivery_time >=1537545600
and d.delivery_time <=1537631999
and m.status>1
and m.is_deleted=0
group by p.sku_id, d.warehouse_id, d.delivery_date_type
===============================================
select
p.sku_id as skuId,
p.sku_name as skuName,
p.sku_unit as skuUnit,
p.sku_price_unit as skuPriceUnit,
p.unit_price_num as unitPriceNum,
p.c1_id as c1Id,
p.c1_name as c1Name,
p.c2_id as c2Id,
p.c2_name as c2Name,
m.city_id as cityId,
d.warehouse_id as warehouseId,
d.delivery_date_type as deliveryDateType,
d.delivery_time as deliveryTime,
sum(p.num*p.unit_sku_num) as sales
from
t_pop_order_main m
left join t_pop_order_product p on m.id=p.order_id
left join t_pop_order_delivery d on m.delivery_id=d.id
where p.pop_id=1252
and p.sku_id in(533864)
and d.c_t >=1537372800
and d.c_t <=1537459199
and m.status>1
and m.is_deleted=0
group by p.sku_id, d.warehouse_id, d.delivery_date_type
标签:_id enum order nbsp name group by date 获取 sum
原文地址:https://www.cnblogs.com/caohuimingfa/p/9718861.html