Leetcode - 1393. Capital Gain/Loss
문제
정답
SELECT stock_name,
SUM(IF(operation = 'Buy', -price, price))
AS capital_gain_loss
FROM Stocks
GROUP BY stock_name
SELECT stock_name,
SUM(IF(operation = 'Buy', -price, price))
AS capital_gain_loss
FROM Stocks
GROUP BY stock_name