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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

convert SQL query to AX query

(0) ShareShare
ReportReport
Posted on by

I need to convert the SQL query below into AX query

select * from  PURCHRFQLINE  a  inner join PURCHRFQTABLE b on

a.RFQID=b.RFQID

inner join PURCHRFQREPLYLINE c

on c.RFQLINERECID=a.RECID

full outer join PURCHLINE d on d.Itemid=a.Itemid AND a.PURCHID = d.PURCHID

*This post is locked for comments

I have the same question (0)
  • Denis Macchinetti Profile Picture
    16,444 on at

    Hi Maram

    AX query mean AOT query or using query objects like the examples on the link below ?

    msdn.microsoft.com/.../aa638454.aspx

    Regards

  • maram fraij Profile Picture
    on at

    I need to create it firstly by code similar to the first example in the link for testing purposes then I will convert it to AOT query using the wizard

  • Suggested answer
    Denis Macchinetti Profile Picture
    16,444 on at

    Hi Maram

    Could be something like this :

       PURCHRFQLINE        PURCHRFQLINE;

       PURCHRFQTABLE       PURCHRFQTABLE;

       PURCHRFQREPLYLINE   PURCHRFQREPLYLINE;

       PURCHLINE           PURCHLINE;

       ;

       while select PURCHRFQLINE  

       join PURCHRFQTABLE

       where PURCHRFQLINE.RFQId == PURCHRFQTABLE.RFQId

       join PURCHRFQREPLYLINE

       Where PURCHRFQREPLYLINE.RFQLINERECID == PURCHRFQLINE.RECID

       outer join PURCHLINE

       Where PURCHLINE.Itemid     == PURCHRFQLINE.Itemid

       &&    PURCHRFQLINE.PURCHID == PURCHLINE.PURCHID

           info (PURCHRFQLINE.RFQId);

    Regards

  • Suggested answer
    Dick Wenning Profile Picture
    8,705 Moderator on at

    please check

    bmdax.blogspot.nl/.../joins-inner-outer-combined.html

    there are some issues

  • refa Profile Picture
    on at

    try to find an alternative query for FULL OUTER JOIN, combination of outer joins, unions

    but i suppose it will not work in AX...

  • Suggested answer
    Denis Macchinetti Profile Picture
    16,444 on at

    Hi Guys

    From my side, the above query work well.

    I have also tested on my environment.

    In this case we don't have a combination of inner join and outer join on the same source as write at the link bmdax.blogspot.nl/.../joins-inner-outer-combined.html

    Regards

  • maram fraij Profile Picture
    on at

    I need to build a query

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
TAHER_El_Mehdi Profile Picture

TAHER_El_Mehdi 3

#2
Mea_ Profile Picture

Mea_ 2

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans