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

Announcements

News and Announcements icon
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,809 Super User 2026 Season 1 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

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 June Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 463 Super User 2026 Season 1

#2
Subra Profile Picture

Subra 409

#3
Martin Dráb Profile Picture

Martin Dráb 280 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans