Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Count duplicate value in table

Posted on by 570

Hello.. 

can anyone help in count duplicate value group by InventLocationId ?

The original table like that

count.png

Here every inventlocationId has one salesId but when I Wrote next code 

    insert_recordset EGCSOCountTMP02 (InventLocationId,CountRec)
    select InventLocationId,count(RecId) from EGCSOCountTMP01
    group by InventLocationId;


the previous count gave me for Ex. U-Sw-Nahia-15 = 4 even it the same salesId

count1.png

what i result need is U-Sw-Nahia-1 = 1 salesId

Thanks

*This post is locked for comments

  • AhmedMgamal Profile Picture
    AhmedMgamal 75 on at
    RE: Count duplicate value in table

    can you please clarify what you want to do, we can't help you as we don't understand what you want to achieve,please provide us with sample of data and expected result and then we can help you to build up the query.

  • Ismail Mohamed Profile Picture
    Ismail Mohamed 570 on at
    RE: Count duplicate value in table

    I also tried to get count from the sales table but same result 

        insert_recordset EGCSOCountTMP02 (InventLocationId,Countrec)
        select InventLocationId from EGCSOCountTMP01
        group by InventLocationId
        join count(RecId) from salesTable 
        where salesTable.SalesId == EGCSOCountTMP01.SalesId;


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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans