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 :
Finance | Project Operations, Human Resources, ...
Answered

while select statement used instead of join in ax 2012 r3

(0) ShareShare
ReportReport
Posted on by 30

HI all,

i need tow basic clarifications

1. If i used nested while select statement ( multiple times ) instead of join , So, what will create a problem in the future? like performance issues in PROD server. 

example -- while select field1, filed 2 from table name
                  {  
                         while select field1, field2, filed3 from table 2
                         where table2,accountnum == table1.accountnum
                        {
                               if(table2.recid)
                               {
                                     // todo
                                }
                        }
                  } 

2.QBDS is always preferable t o use? 

kindly confirm

  

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    1. Nested statements are bad for performance so use join instead.

    If you use join, exactly one statement is sent to the database and you get one result (which you can then iterate in your code, using while statement). Only one round trip to database is made.

    If you use nested statements you might make dozens or hundreds of database calls which is bad.

    In general you should try to minimize the number of database calls.

    2. No, it's not "always preferable to use".

  • @rp@n Profile Picture
    30 on at

    thanks Nikoloas,

    finally one thing

    is it true like qbds query is much faster than while select?

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    No, it's not true.

    A select statement and a Query() based query will anyway be translated to a T-SQL statement in the AOS, and then this statement is sent to the database. So in the database there is no difference and therefore the performance is the same.

  • @rp@n Profile Picture
    30 on at

    thanks Nikoloas

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans