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, ...
Suggested Answer

Converting SQL query to SysDa Query in X++

(0) ShareShare
ReportReport
Posted on by 20
Hi ,
 
Could someone please suggest how we can convert below SQL query to SysDa query.
 
select * from TAXTRANS_IN left join 
HSNCODETABLE_IN on TAXTRANS_IN.HSNCODETABLE = HSNCODETABLE_IN.RECID
left join 
SERVICEACCOUNTINGCODETABLE_IN on TAXTRANS_IN.SERVICEACCOUNTINGCODETABLE = SERVICEACCOUNTINGCODETABLE_IN.RECID
 
Thanks in advance.
I have the same question (0)
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,449 Super User 2025 Season 2 on at
    Hi,
     
    try this code :
            TAXTRANS_IN                         taxTans;
            HSNCODETABLE_IN                     hsnCodeTable;
            SERVICEACCOUNTINGCODETABLE_IN       serviceAccCodeTable;
    
            SysDaQueryObject qTaxTrans                       = new SysDaQueryObject(taxTans);
            SysDaQueryObject qHsnCodeTable                   = new SysDaQueryObject(hsnCodeTable);
            SysDaQueryObject qserviceAccCodeTable            = new SysDaQueryObject(serviceAccCodeTable);
    
            qHsnCodeTable.whereClause(new SysDaEqualsExpression
                                        (new SysDaFieldExpression(taxTans, fieldStr(TAXTRANS_IN, HSNCodeTable)),
                                         new SysDaFieldExpression(hsnCodeTable, fieldStr(HSNCODETABLE_IN, RecId))));
    
            qserviceAccCodeTable.whereClause(new SysDaEqualsExpression
                                        (new SysDaFieldExpression(taxTans, fieldStr(TAXTRANS_IN, ServiceAccountingCodeTable)),
                                         new SysDaFieldExpression(serviceAccCodeTable, fieldStr(SERVICEACCOUNTINGCODETABLE_IN, RecId))));
    
            qTaxTrans.joinClause(SysDaJoinKind::InnerJoin, qHsnCodeTable);
            qTaxTrans.joinClause(SysDaJoinKind::InnerJoin, qserviceAccCodeTable);
    Best regards,
    Mohamed Amine MAHMOUDI
  • Indra sena Profile Picture
    20 on at
    Thanks for the reply Mohamed,
     
    I've created the query as you've specified and found that there is an issue in it.
     
    The second joinClause seems to be overwriting the previous joinclause , refer the below query string after executing it.
     
     
     FROM TaxTrans_IN 
     JOIN FROM ServiceAccountingCodeTable_IN 
     WHERE (TaxTrans_IN.ServiceAccountingCodeTable == ServiceAccountingCodeTable_IN.RecId)
     
    Could you suggest how we can overcome this ?

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
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans