leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1393.sql (212B)


      1 SELECT 
      2     stock_name,
      3     SUM(
      4         CASE 
      5             WHEN operation = 'buy' THEN -price
      6             WHEN operation = 'sell' THEN price
      7         END
      8     ) AS capital_gain_loss
      9 FROM Stocks
     10 GROUP BY stock_name