Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

display the active and last price for each item

Posted on by 120

Hi friends

I would like to display the active and last price for each item from this query select statement 

I have try here to join those three tables   INVENTITEMPRICE  , InventDim , nventTable  and actually I am not getting the correct answer from this query select statement 

SELECT A.ITEMID AS ITEMID,A.NameAlias AS ItemName,B.configId AS LENGHT,B.InventColorId AS WIDTH,B.InventSizeId AS HIGHT,MAX(T1.CREATEDDATETIME) AS MAXCREATEDDATETIME,MAX(T1.ACTIVATIONDATE) AS MAXACTIVATIONDATE,
T1.VERSIONID AS VERSIONID,T1.PRICETYPE AS PRICETYPE,T1.INVENTDIMID AS INVENTDIMID,
T1.DATAAREAID AS DATAAREAID,T1.PARTITION AS PARTITION
FROM InventDim B RIGHT OUTER JOIN INVENTITEMPRICE T1 ON B.InventDimId = T1.InventDimId
RIGHT OUTER JOIN InventTable A ON A.ItemId = T1.ItemId
WHERE A.ITEMID like '4%' OR A.ITEMID like '5%'
GROUP BY A.ITEMID,A.NameAlias,B.configId,B.InventColorId,B.InventSizeId,T1.VERSIONID,T1.PRICETYPE,T1.INVENTDIMID,T1.DATAAREAID,T1.PARTITION

Best regards

Jamil 

*This post is locked for comments

  • Suggested answer
    Chaitanya Golla Profile Picture
    Chaitanya Golla 17,225 on at
    RE: display the active and last price for each item

    Hi,

    Please try the following query and let me know if anything is missing.

    select
    distinct priceGroup.ITEMID, 
    A.NameAlias as ItemName,
    B.configId,
    B.InventColorId,
    B.InventSizeId,
    T1.PRICE, 
    priceGroup.MAXCREATEDDATETIME, 
    priceGroup.MAXACTIVATIONDATE, 
    priceGroup.VERSIONID, 
    priceGroup.INVENTDIMID,
    priceGroup.PRICETYPE,
    T1.DATAAREAID AS DATAAREAID,
    T1.[PARTITION] AS [PARTITION]
    from InventItemPrice T1
    join  InventItemPriceCurrentActive priceGroup
    on T1.ITEMID = priceGroup.ITEMID
    join InventDim B
    on B.INVENTDIMID = T1.INVENTDIMID
    and B.INVENTDIMID = priceGroup.INVENTDIMID
    join inventTable A
    on A.itemid = T1.itemId
    where A.ITEMID like '4%' OR A.ITEMID like '5%'


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans