1.查询某个渠道SKU是否在凤凰计划调过库存


2.导出刊登8560报错清除品牌池历史信息,给业务确认

相关SQL:
select c.OrderSourceCountry as '站点',
--c.OrderSourceID,
o.OrderSourceName as '渠道',
c.BrowsePathByID, tree.BrowseNodeNameCn +'('+tree.BrowsePathByName+')' as '一级类目ID',
c.TotalNum as '刊登总量' ,c.ErrorNum as '8560报错数量', c.ErrorRate as '8560报错比例',c.ConfigNum as '8560数量配置',c.ConfigRate as '8560比例配置',
ad.UserName as '首选业务员',ad.UserFullPathName as '首选业务 部门',c.AddTime as 首次删除时间,'' as 品牌池是否恢复,temp1.MaxOrderSourceSKU as '1个失败渠道SKU'
from RB_Amazon_ClearBrandPool_Log(nolock) c
left join RB_OrderSource(nolock) o on c.CustomerID=o.CustomerID and c.OrderSourceID=o.ID
left join RB_admin(nolock) ad on c.CustomerID=o.CustomerID and o.SaleAdminID=ad.ID
left join @F_Node tree on tree.Country=c.OrderSourceCountry and tree.FirstBrowsePathByID=c.BrowsePathByID
left join (
SELECT x.OrderSourceID,
os.OrderSourceCountry,
temp.FirstBrowsePathByID,
x.CustomerID,
COUNT(1) num,MAX(x.OrderSourceSKU) as MaxOrderSourceSKU
FROM dbo.RB_AmazonUploadProduct_V2 (NOLOCK) x
INNER JOIN dbo.RB_AmazonUploadResult_V2 (NOLOCK) y
ON x.CustomerID = y.CustomerID
AND x.QueueID = y.ID
INNER JOIN dbo.RB_OrderSource (NOLOCK) os
ON os.CustomerID = x.CustomerID
AND os.ID = x.OrderSourceID
INNER JOIN @F_Node temp
ON y.BrowsePathByID LIKE '' + temp.FirstBrowsePathByID + ',%'
and temp.Country=os.OrderSourceCountry
WHERE x.CustomerID = 1
AND x.Status = 3
AND x.MessageCode LIKE '%8560%'
AND ISNULL(x.UploadType, 1) = 1
AND x.AddUserID > 0
AND x.AddTime < '2023-09-20' and x.AddTime>='2023-08-13'
GROUP BY x.OrderSourceID,
temp.FirstBrowsePathByID,
os.OrderSourceCountry,
x.CustomerID
) temp1 on temp1.CustomerID=c.CustomerID and temp1.OrderSourceID=c.OrderSourceID and temp1.FirstBrowsePathByID=c.BrowsePathByID
where c.CustomerID=1