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)

How to Used Order By and Group By Clause in x++ Language when joins four table or more table......

(0) ShareShare
ReportReport
Posted on by 875

Anyone cal tell me how to use Order By and Group By Clause in score table on marks .Field of score table is score1,socre2,score3  like

static void CXT_Joins(Args _args)
{
CXT_Student stud;
CXT_ContacInformation contact;
CXT_Location location;
CXT_Score score;
int k=0;
;
while select stud
join score
where stud.Cxt_Stud_Id==score.Cxt_Stud_Id
join location
where stud.Cxt_Stud_Id==location.Cxt_Stud_Id
join contact
where stud.Cxt_Stud_Id==contact.Cxt_Stud_Id
info("Hi Number has inserted");
info(strFmt("Id Is=%1---Score1 Is=%2---Score2 Is=%2----Score3 Is=%3---Location Is=%4---Mobile No Is=%5",stud.Cxt_Stud_Id,score.Score1,score.Score2,score.Score3,location.Location,contact.ContactPersonPhone));

}

 

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    The syntax is documented, unsurprisingly, in Select Statement Syntax [AX 2012].

    You also have to realize that if you group records, you'll get values only those fields that are either grouped by or are aggregated (using aggregation functions such as sum() and maxOf()). You said that you want to group by Score1, Score2 and Score3, but you're also returning Cxt_Stud_Id, Location and ContactPersonPhone. You have to decide what to do with these fields.

  • Vikas_AX_Blogs Profile Picture
    875 on at

    Hi Martin Sir

    i am beginner in AX and its only for practice. I want to arrange   Score in  Ascending and descending format  so how to apply order by clause in this x++ Code.

  • Community Member Profile Picture
    on at

    Hi Vikas,

    Can you please explain with example about how is your data in the tables and what results you want based on that?

  • Verified answer
    Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    Vikash, please let me quote the documentation of select statement syntax (already linked above).

    KeywordDescriptionExample
    asc An option on the order by or group by clause. The sorting is ascending. (Sort is ascending by default.) select * from custTable
        order by Name asc;
    desc An option on the order by or group by clause. The sorting is descending. select * from custTable
        order by Name desc;

    Seriously, you won't become a developer if you don't learn how to use documentation.

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans