最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

查看SQL中的高级规则结构(查询)/ Reviewing Advance Rule structure in SQL (Query)

网络文摘 William 384浏览 0评论
This SQL query is worth to share and can be used if we need to review Advance rule structure outside Dynamics AX    
 ;with CTE_tbl as  
 (  
 select DH.NAME as 'AdvanceRuleStructure', DH.DESCRIPTION  
 ,DHL.LEVEL_  
 ,DA.NAME  
 --,DCNC.RANGETO  
 , DCNC.RANGEFROM from DimensionHierarchyLevel DHL  
 inner join DimensionAttribute DA  
 on DA.RECID = DHL.DIMENSIONATTRIBUTE  
 inner join DIMENSIONHIERARCHY DH  
 on DH.RECID = DHL.DIMENSIONHIERARCHY  
 and DH.STRUCTURETYPE = 1  
 inner join DIMENSIONCONSTRAINTTREE DCT  
 on DCT.DIMENSIONHIERARCHY = DH.RECID  
 inner join DimensionConstraintNode DCN  
 on DCN.DIMENSIONCONSTRAINTTREE = DCT.RECID  
 and DHL.RECID = DCN.DIMENSIONHIERARCHYLEVEL  
 INNER JOIN DimensionConstraintNodeCriteria DCNC  
 on DCNC.DIMENSIONCONSTRAINTNODE = DCN.RECID  
 )  
 select  
   AdvanceRuleStructure, DESCRIPTION  
 , Max(case when LEVEL_=1 then RANGEFROM end )as BU  
 , Max(case when LEVEL_=2 then RANGEFROM end )as CC  
 , Max(case when LEVEL_=3 then RANGEFROM end )as Market  
 , Max(case when LEVEL_=4 then RANGEFROM end )as Region  
 FROM CTE_tbl  
 group By AdvanceRuleStructure,DESCRIPTION  
SQL Query view.
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址