I am trying to join two tables InventSum and InventDim with InventDimId and groupBy InvetSum.DataAreaId,InventDim.InventLocationID …
Similar to below SQL : select InventLocationId,SUM(physicalinvent),sum(availphysical),sum(ordered),dataareaid from inventsum inner join InventDIm group by inventLocationID,DATAAREAID
Thanks in advance … How can we achieve this in X++ ?
You obvoiusly does not need a DataAreaId unless you are using a cross company query.
while select sum(PhysicalInvent) from inventSum
join inventDim group by InventLocationId
where inventSum.InventDimId == inventDim.inventDimId //// you may need an ItemId predicate along as the stock is viewed per item
{
print inventSum.PhysicalInvent;
}