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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

query inner join

(0) ShareShare
ReportReport
Posted on by 452
Hi,

As you can see in the query attached image, i have two tables inner joined with each other, where i only selected one field from first table and no fields from the other table
 
Why when calling Query::delete_from(query);
 
in trace parser, it appears as cross join, and it selects all fields from the 2nd table even though i didn't add any field. And even if i select one field from table 2, trace parser still selects all fields and still make it as cross join but it selects one field from the first table correctly.... Any idea?

Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    237,668 Most Valuable Professional on at
    query inner join
    Can't you simply use an exists join instead of an inner join?
     
    Is Dynamic Fields property of the XXXParameters set to No?
  • DELDYN Profile Picture
    452 on at
    query inner join
    Hi Martin,

    yes dynamics fields property is No. If i don't add any field to xxxParameters or if i add one field, it will still show all fields with cross join

    Yes i can use exists join but i wanted to know if there is a reason for this
  • Martin Dráb Profile Picture
    237,668 Most Valuable Professional on at
    query inner join
    Can you reproduce it with standard tables, so others can test it? Or is it specific to your table and we should check what's so special with your table?
  • DELDYN Profile Picture
    452 on at
    query inner join
    Hi Martin,

    I will try to reproduce it with standard tables and let you know. But not sure what would be special about those tables that would make it different. (please note that those two tables are custom tables but not in my model)

    but just to add

    Exists join at first resulted in worse performance.


    With inner join:

    In trace parser, the call tree showed inclusive(ms) =588.65 for the query below




    Now after i changed it to exists join:

    In trace parser ,the call tree showed inclusive(ms) =1291,37 for the query below

    I'm not sure why it said SELECT 'X' FROM XXXPARAMETERS T2   (maybe because i didn't put any fields in the query for the parameters table)
    SELECT T1.XXXID,
    	T1.RECVERSION,
    	T1.RECID 
    FROM AMRENTTABLE T1 
    WHERE (((T1.PARTITION=5637144576) 
    	AND (T1.DATAAREAID=N'XXX')) 
    	AND ((T1.CREATEDDATETIME>='2025-12-7') 
    	AND (T1.CREATEDDATETIME<='2025-12-8'))) 
    	AND 
    EXISTS (
    SELECT 'X' 
    FROM XXXPARAMETERS T2 
    WHERE (((T2.PARTITION=5637144576) 
    	AND (T2.DATAAREAID=N'XXX')) 
    	AND ( 
    	NOT ((T2.XXXLOCATIONID='''')) 
    	AND (T1.XXXLOCATIONID=T2.XXXLOCATIONID)))) 
    	ORDER BY T1.XXXID

    then i repeated it again with exists join, but this time i didn't leave fields empty in the query for XXXParameters table, i added one field which is XXXLocationId to the query.

    Now in trace parser, the call tree showed inclusive(ms) =371.94 

    but the query still showed select 'X' from XXXParameters, not sure why


    So does that mean i need to use exists join, and select a field in the query from XXXParameters table and not leave it with empty fields?

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 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans