InventTable t; InventSum s; ... select ItemId from t where t.dimGroupId = "..." || t.DimGroupId = "..." exists join s where s.itemid == t.itemid && s.posedQty > 0