Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

selecting record from a table that does not exist in other two tables(notexists join)

(0) ShareShare
ReportReport
Posted on by 400

Hi All,

I have  2 tables header and line each having a field x now I have to compare it with table t having field x , if the header has line we need to compare header.x   == t.x else line.x== t.x. I need to filter records where the value is present in only header I.e it has no line records and no record in table t (header.recid == line.refrecid). I was trying two not exists join but that does not work in ax

while select header 

notexists join line where line.refrecid == header.recid

notexists join t where t.x == header.x

{}

Can someone suggest an alternative?

Thanks,

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: selecting record from a table that does not exist in other two tables(notexists join)

    It needs to be written in two seperate blocks.

  • Suggested answer
    Crispin John Augustine Profile Picture
    Crispin John Augustine 37,081 on at
    RE: selecting record from a table that does not exist in other two tables(notexists join)

    try separating them into two blocks:

    while select header 

    notexists join line where line.refrecid == header.recid

    {

    select firstOnly t where t.x == header.x

    if (!t.RecId)

    {

    //Your Code here

    }

    }

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans