join a table with 2 tables

i want to join a table with 2 tables in x++ using qbds

for ex. i want to join sales table with salesline table and hcmworker table

And what’s the problem?

actually i am confused about the sequence i have to write for these joins… i want to make inner join with both tables so can i have that or it will ignore one join out of two ?

It’s rather simple:

Query q = new Query();
QueryBuildDataSource headerDs = q.addDataSource(tableNum(SalesTable));
QueryBuildDataSource lineDs   = headerDs.addDataSource(tableNum(SalesLine));
QueryBuildDataSource workerDs = headerDs.addDataSource(tableNum(HcmWorker));
// and some additional code to define relations
lineDs.relations(true);
workerDs.addLink(…);

q = new Query();

qbds = q.addDataSource(tableNum(inventTrans));

qbds.addSelectionField(fieldNum(inventTrans,Qty),SelectionField::Sum);

qbr = qbds.addRange(fieldNum(inventTrans,ItemId));

qbds = qbds.adddatasource(tableNum(InventDim));

qbds.addGroupByField(fieldNum(InventDim,InventbatchId));

qbds.relations(true);