Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

join tables in X++

Posted on by Microsoft Employee

Hi , 

i have Table "A" and  i  need to join Table "B" and Table "C" to Table "A"

EX:

while select X from A where A.ID == '5'

Join B where A.BID==B.ID

join C where A.CID==C.ID

any help to make right join between three tables

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,147 on at
    RE: join tables in X++

    AX does not do a right join. You can put your "right" table as top of the select statement, and do an outer join on the "left" table. This way it will return all rows as a SQL right join would for the right table, and only rows that match based on the relation from the left table.

    Results are identical to what you would expect with a right join.

    So we do make use of the left outer join T-SQL syntax here instead, see what Mahmoud has linked.

  • Suggested answer
    Chaitanya Golla Profile Picture
    Chaitanya Golla 17,225 on at
    RE: join tables in X++

    Hi,

    Code whatever you are using seems to be fine, are you looking for sql statement for the same.

    Alternatively you can use this:

    while select X from A  

    Join B where A.BID==B.ID

    join C where A.CID==C.ID

    && A.ID == '5'

    {

    // Your code.

    }

    SQL STATEMENT:

    select A.X

    inner join B on A.BID = B.BID

    inner join C on C.ID = A.CID

    where A.ID = 5

  • Suggested answer
    Mahmoud Hakim Profile Picture
    Mahmoud Hakim 17,887 on at

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,420 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,672 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans