leading-project/dw/dwd/dwd_innoveco_order_info_d.sql
2024-11-27 11:07:58 +08:00

24 lines
757 B
SQL

select
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 -- 退款金额
from ods_weimob_order_listsearch_orderinfo_d a
left join (
select orderNo, sum(salePrice*skuNum) salePrice
from ods_weimob_order_listsearch_orderinfo_items_d
group by orderNo
) b
on a.orderNo = b.orderNo
left join (
select orderNo, sum(refundCash) refundCash
from ods_weimob_rights_list_d
where rightsstatus = '6'
group by orderNo
) c
on a.orderNo = c.orderNo
where a.isDeleted = 0 and a.orderStatus != 9