src-db/database/sourcedata/AD_TABLE.xml
changeset 24865 ae70656351d2
parent 24863 ac4b21f98aaa
child 24880 0f496c17e6b7
--- a/src-db/database/sourcedata/AD_TABLE.xml	Fri Sep 05 10:24:15 2014 +0200
+++ b/src-db/database/sourcedata/AD_TABLE.xml	Fri Sep 05 11:14:07 2014 +0200
@@ -11379,7 +11379,7 @@
       where lcra.landedCostCost = lcc)
   ) as products,
   lcm.amount as amttomatch,
-  (select sum(lcm.amount)
+  (select sum(otherlcm.amount)
    from LandedCostMatched as otherlcm
    where otherlcm.landedCostCost = lcc
      and otherlcm.invoiceLine != il 
@@ -11402,8 +11402,8 @@
 from LandedCostCost as lcc
   join lcc.landedCost as lc
   join lcc.landedCostType as lct
-  left join lcc.landedCostMatchedList  as lcm
-  left join lcm.invoiceLine as il
+  left join lcc.landedCostMatchedList as lcm with lcm.invoiceLine.id = :invlineid,
+  InvoiceLine as il
 where (lcc.isMatchingAdjusted = false or lcm is not null)
   and @additional_filters@
   and @insertion_point_0@