General X++ Development
How do I use multiple joins in an X++ select statement?
How do I use multiple joins in an X++ select statement?
1 answer
Write an answerKeep adding joins to the same select.
SalesTable salesTable;
CustTable custTable;
DirPartyTable party;
while select salesTable
join custTable
where custTable.AccountNum == salesTable.CustAccount
join party
where party.RecId == custTable.Party
{
info(strFmt('%1 - %2', salesTable.SalesId, party.Name));
}If the relationship can be handled in one query, do that. Nested selects are usually just extra round trips to SQL.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer