16-09-13, 05:41 PM
الحل
كود :
select inw000.codx, SUM(distinct inw000.amunx) as المدخل,
SUM(distinct outw000.amunx) as المخرج ,(SUM( distinct inw000.amunx) - SUM( distinct outw000.amunx) ) as المتبقي
from inw000 inner join outw000 on inw000.codx = outw000.codx where inw000.codx = outw000.codx group by inw000.codx