General X++ Development
How do I use `exists join` in X++?
How do I use exists join in X++?
1 answer
Write an answerUse exists join when the second table is only there to prove that a related record exists.
CustTable custTable;
SalesTable salesTable;
while select custTable
exists join salesTable
where salesTable.CustAccount == custTable.AccountNum
{
info(custTable.AccountNum);
}This returns customers that have at least one sales order. You are not using the joined SalesTable buffer for output, so there is no reason to do a normal join.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer