web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

display the active and last price for each item

(0) ShareShare
ReportReport
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
    17,225 on at

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans