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

Announcements

No record found.

News and Announcements icon
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 56

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

  

  • Verified answer
    nmaenpaa Profile Picture
    101,172 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
    56 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,172 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
    56 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 426 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 358

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 353 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans