सशर्त एकत्रीकरण का उपयोग करें:
select sum(case when type = 1 then value else - value end) as value
from table t
group by year;
सशर्त एकत्रीकरण का उपयोग करें:
select sum(case when type = 1 then value else - value end) as value
from table t
group by year;