I want tosubtractthe number of entrieswiththe number of outputsof my products,but I have aproblem...the result isnot correct,when I dothe subtractionto getthe current amount ofmy products.
alsoI haveseveral inputs andoutputs of the sameproduct.
please I need your help
select e.codpro,(sum(e.cantidad)) as productentry from entradapro e
group by e.codpro
select s.codpro,(sum(s.cantidad)) as productoutput from salidapro s
group by s.codpro
select e.codpro,(sum(e.cantidad)- sum(s.cantidad))as total from entradapro e inner join salidapro s
on e.codpro = s.codpro
group by e.codpro