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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Select count(Distinct XX)

(0) ShareShare
ReportReport
Posted on by 2,546

Hello everyone!!

i want to count unique PackingSlipId from vendpackingSlipTrans.

[

SQL STATEMENT: 

select count(Distinct itemId) from INVENTTRANS

]

How can i achieve this w/o using While Loop or SysQuery::countTotal??

Regards,

Piyush Adhikari

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    select count(Field) from Table

    group by Field;

  • Piyush Adhikari Profile Picture
    2,546 on at

    not working

  • Piyush Adhikari Profile Picture
    2,546 on at

    already tried it!!

  • Suggested answer
    Community Member Profile Picture
    on at

    Try recid

    select count(RecId) from Table

    group by Field;

  • Iulian Cordobin Profile Picture
    8,201 on at

    What exactly are you trying to count, because you are mentioning two tables (vendPackingSlipJour and InventTrans)?

  • Iulian Cordobin Profile Picture
    8,201 on at

    Applying count when a group clause is present will return the number of records for each distinct group by field, not the number of distinct values.

  • Piyush Adhikari Profile Picture
    2,546 on at

    sir,

    i want to get total unique rows  count of any field

    for example

    SQL - select count(Distinct itemId) from INVENTTRANS

  • Piyush Adhikari Profile Picture
    2,546 on at

    always return 1

  • Piyush Adhikari Profile Picture
    2,546 on at

    or

    SQL - select count(packingSlipId) from VendpackingSlipTrans

  • Piyush Adhikari Profile Picture
    2,546 on at

    oops

    SQL - select count(Distinct packingSlipId) from VendpackingSlipTrans

    it looks Distinct is not supported in Ax :(

    i dont want to use QueryClass Or while loop

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans