Hi all, does not work the query written with the new syntax of AX 2012 and I do not know how to rewrite it: below is written in SQL and X ++ you tell me where am I wrong?

Thank you for your help

Mak5s

example SQL

select InventTable.BFItemLineId,

InventSum.ItemId,

InventDim.InventSizeId,

InventDim.InventSiteId,

InventDim.InventLocationId,

sum(PostedQty + Received- Deducted + Registered - Picked) as stockQty

sum(PostedValue),

sum(PostedQty),

sum(PhysicalValue),

sum(Received),

sum(Deducted)

from InventTable

inner

join InventSum

on InventSum.ItemId = InventTable.ItemId

inner

join InventDim

on InventDim.InventDimId = InventSum.InventDimId

group by InventTable.BFItemLineId,InventSum.ItemId, InventDim.InventSizeId, InventDim.InventSiteId, InventDim.InventLocationId

having sum(InventSum.PostedQty + InventSum.Received - InventSum.Deducted) <> 0

example X++

### select InventSum.ItemId,

InventDim.InventSizeId,

InventDim.InventSiteId,

InventDim.InventLocationId,

sum(locInventSum.PostedValue),

sum(locInventSum.PostedQty),

sum(locInventSum.PhysicalValue),

sum(locInventSum.Received),

sum(locInventSum.Deducted)

from locInventSum

where locInventSum.ItemId == locInventTable.ItemId

join locInventDim

where locInventDim.InventDimId == locInventSum.InventDimId

group by locInventTable.BFItemLineId, locInventSum.ItemId, locInventDim.InventSizeId, locInventDim.InventSiteId, locInventDim.InventLocationId