sql GPA - PriceAnalysisChange - Produtos fora dos Alertas

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql GPA - PriceAnalysisChange - Produtos fora dos Alertas相关的知识,希望对你有一定的参考价值。

declare @retailstoreid varchar(18);
set @retailstoreid = 'S1688';

select i.itemid as 'ItemID',
	   i.name as 'Name',
	   irs.retailstoreid as 'RetailStoreId',
	   hs.hierarchicalstructureid as "Id Estrutura Mercadológica",
	   hs.Name as 'Nome Estrutura Mercadológica'
from ra.item i
join ra.itemretailstore irs on irs.itemid = i.itemid
join ra.HierarchicalStructure hs on hs.HierarchicalStructureid = i.HierarchicalStructureId
where i.itemid in (select itemid from stra.itempricechange with(nolock) where retailstoreid = @retailstoreid and pricechangedate > getdate() -1) and i.hierarchicalstructureid not in (SELECT DISTINCT hsp.HierarchicalStructureId
						FROM ra.HierarchicalStructurePath hsp
						INNER JOIN ra.BusinessStructureItem bsi ON bsi.HierarchicalStructureId = hsp.HierarchicalAncestorId
						WHERE bsi.BusinessStructureListId in (select a.businessstrucutureid from tm.alertconfig a join tm.locationitem li on li.locationlistid = a.locationlistid where li.retailstoreid = @retailstoreid and a.[status] IN ('A','W')))
and irs.retailstoreid = @retailstoreid;

以上是关于sql GPA - PriceAnalysisChange - Produtos fora dos Alertas的主要内容,如果未能解决你的问题,请参考以下文章

sql GPA - PriceAnalysisChange - RelatórioporLoja

sql GPA - PriceAnalysisChange - Produtos fora dos Alertas

PL/SQL 如何比较触发器中的表达式?

比较 SQL 中的两个关系

第3天SQL快速入门-高级查询(SQL 小虚竹)

带有聚合函数的PL / SQL触发器