leading-project/dw/dwd/dwd_innoveco_order_info_d.sql

24 lines
757 B
MySQL
Raw Normal View History

2024-07-21 22:06:45 +08:00
select
2024-08-09 17:53:14 +08:00
a.orderNo
, from_unixtime(cast(left(a.createTime,10) as unsigned integer)) createTime -- 创建时间
, from_unixtime(cast(left(a.confirmTime,10) as unsigned integer)) confirmTime -- 收货时间
, a.orderStatus -- 订单状态
, a.vid -- 项目id
, a.vidName -- 项目名称
, b.salePrice -- 销售金额
, c.refundCash -- 退款金额
2024-07-21 22:06:45 +08:00
from ods_weimob_order_listsearch_orderinfo_d a
2024-08-09 17:53:14 +08:00
left join (
select orderNo, sum(salePrice*skuNum) salePrice
from ods_weimob_order_listsearch_orderinfo_items_d
group by orderNo
2024-07-21 22:06:45 +08:00
) b
2024-08-09 17:53:14 +08:00
on a.orderNo = b.orderNo
left join (
select orderNo, sum(refundCash) refundCash
from ods_weimob_rights_list_d
where rightsstatus = '6'
group by orderNo
2024-07-21 22:06:45 +08:00
) c
2024-08-09 17:53:14 +08:00
on a.orderNo = c.orderNo
2024-07-21 22:06:45 +08:00
where a.isDeleted = 0 and a.orderStatus != 9