- Published on
Leetcode - 1393. Capital Gain/Loss
- Authors
- Name
- Indo Yoon
Table of Contents
문제
[Loading...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
LeetCode
](https://leetcode.com/problems/capital-gainloss/)
정답
SELECT stock_name,
SUM(IF(operation = 'Buy', -price, price))
AS capital_gain_loss
FROM Stocks
GROUP BY stock_name