-
1393. Capital Gain/Loss mysqlLeetCode_Study_Plan/SQL 2022. 10. 3. 19:03
https://leetcode.com/problems/capital-gainloss/?envType=study-plan&id=sql-i
select tb.stock_name, sum(price) as capital_gain_loss from (select stock_name, IF(operation = "Buy" , price*(-1), price) as price from stocks) tb group by stock_name;
'LeetCode_Study_Plan > SQL' 카테고리의 다른 글
182. Duplicate Emails mysql (0) 2022.10.04 1158. Market Analysis I mysql (0) 2022.10.03 1407. Top Travellers mysql (0) 2022.10.03 1741. Find Total Time Spent by Each Employee mysql (0) 2022.10.02 1890. The Latest Login in 2020 mysql (0) 2022.10.02