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)
Answered

X++ select group by date

(0) ShareShare
ReportReport
Posted on by

Hi,

It seems a stupid question but I tried multiple combination and failed.

In table A, I have thousands of records and I want to get all the different dates in this record.

In SQL, I know I can do it simply by

select date from TableA group by date

But now for X++ in AX

I tried

while select   A group by A.Date
{

}

without success. In MS doc, the examples are for number or counting no dates. I don't quite understand how to achieve my requirement.  Any help is grateful! Thanks!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at

    https://msdn.microsoft.com/en-us/library/aa656402.aspx

    group by

    Instructs the database to group selected records by fields.

    CustTable custTable;

    ;

    while select sum(CreditMax) from custTable

        group by CustGroup

    {

        print custTable.CustGroup, " ",custTable.CreditMax;

    }

    You could do a count(RecId) to see how many records you have for the specific date instead of the sum() aggregate function in the example, and use the date for your grouping.

  • Martin Dráb Profile Picture
    238,787 Most Valuable Professional on at

    It would help if you actually explained your problem. Saying "without success" doesn't tell us too much.

  • Community Member Profile Picture
    on at

    Hi Martin, my result is no result in return in my selection

  • Mea_ Profile Picture
    60,286 on at

    Do you have any records in that company ?

  • Community Member Profile Picture
    on at

    Yes, you are right. I made a mistake.

  • Community Member Profile Picture
    on at

    Thanks, the problem is solved.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans