Hi! I used this topic and this topic to create my query:
Code
SEL ECT
Items.Ref,
InventoryBalance.Company,
InventoryBalance.QuantityBalance
FR OM
Catalog.Items AS Items
LEFT JOIN AccumulationRegister.Inventory.Balance AS InventoryBalance
ON (InventoryBalance.Item = Items.Ref)
But it returns NULL instead of 0 for items having 0 Inventory balance...
Thank you, Alexey! I changed my query in the following way:
Code
SEL ECT
Items.Ref,
InventoryBalance.Company,
ISNULL(InventoryBalance.QuantityBalance, 0) AS QuantityBalance
FR OM
Catalog.Items AS Items
LEFT JOIN AccumulationRegister.Inventory.Balance AS InventoryBalance
ON (InventoryBalance.Item = Items.Ref)
Now there is one more question: I need to filter the result by company. How can I do that?
What do you want to get as result? The list of all Items with balance for one particular company?
Code
SEL ECT
Items.Ref,
InventoryBalance.Company,
ISNULL(InventoryBalance.QuantityBalance, 0) AS QuantityBalance
FR OM
Catalog.Items AS Items
LEFT JOIN AccumulationRegister.Inventory.Balance(, Company = &Company) AS InventoryBalance
ON (InventoryBalance.Item = Items.Ref)