source_logistics_ecommerce_.../sql reports/missing sales orders.sql

13 lines
314 B
Transact-SQL

--find PO in files sent by SL
--trim file to just the missing po
select
[SL_ECOMM].site,
[SL_ECOMM].order_id,
SOH.SOHNUM_0
from [analytics].[dbo].[SL_ECOMM]
left join PROD.SORDER SOH
on [SL_ECOMM].site = SOH.STOFCY_0
and [SL_ECOMM].order_id = SOH.CUSORDREF_0
and SOH.SOHTYP_0 = 'WEB'
where
SOH.SOHNUM_0 is null