mysql with if statements only
\nselect stock_name,(sum(if(operation=\'Sell\',price,0))-sum(if(operation=\'Buy\',price,0)))\nas capital_gain_loss \nfrom Stocks\ngroup By stock_name;\n
```\nselect stock_name,(sum(if(operation=\'Sell\',price,0))-sum(if(operation=\'Buy\',price,0)))\nas capital_gain_loss \nfrom Stocks\ngroup By stock_name;\n```
[]