I guess simple CASE
and GROUP BY
should work
select market,
sum(case when type="sell" then -amount
when type="buy" then amount end)
from data
group by market
2
solved Can we achieve this if yes then what will the SQL query for same