sql Tombamento - Itensnôipodadosauditoria adhoc por departamento

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql Tombamento - Itensnôipodadosauditoria adhoc por departamento相关的知识,希望对你有一定的参考价值。

DECLARE @RetailStoreId VARCHAR(18) SET @RetailStoreId='S0013'
SELECT DISTINCT REPLACE(ac.Name, 'Remarcação de Preços - ', ''), irs.ItemId
FROM ra.ItemRetailStore irs WITH(NOLOCK)
	INNER JOIN ra.Item i WITH(NOLOCK) ON i.ItemId = irs.ItemId
	INNER JOIN ra.HierarchicalStructurePath hsp WITH(NOLOCK) ON hsp.HierarchicalStructureId = i.HierarchicalStructureId
	INNER JOIN ra.BusinessStructureItem bsi on bsi.HierarchicalStructureId = hsp.HierarchicalAncestorId
	INNER JOIN tm.AlertConfig ac WITH(NOLOCK) ON ac.BusinessStrucutureId = bsi.BusinessStructureListId AND ActionId=14
WHERE irs.Status='A' and irs.RetailStoreId=@RetailStoreId AND irs.itemid not in ( 
	SELECT DISTINCT i.ItemId from tm.Task t WITH(NOLOCK)
		INNER JOIN tm.TaskItem i WITH(NOLOCK) ON i.TaskId=t.TaskId
	WHERE t.CreateDate > '2017-07-24 00:00:00' AND t.ActionId=1 AND t.status='F' AND t.AlertTypeId IS NULL AND t.RetailStoreId=@RetailStoreId
)
GROUP BY ac.Name, irs.ItemId
ORDER BY 1, 2

以上是关于sql Tombamento - Itensnôipodadosauditoria adhoc por departamento的主要内容,如果未能解决你的问题,请参考以下文章

sql Canção - Tombamento por Lista de Produtos

SQL*Plus中怎么执行多个*sql脚本文件

sql 2008和sql 2012的区别

sql [sql技巧]一些sql技巧#sql

sql 2008 r2 在sql 2008上兼容么

SQL基础