Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 48fd048

Browse files
Capital Gain/Loss
1 parent f72a841 commit 48fd048

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Link: https://leetcode.com/problems/capital-gainloss/
2+
Tool: MS SQL Server
3+
4+
5+
6+
7+
8+
9+
10+
select stock_name, sum(case when operation = 'Sell' then price else -price end) as capital_gain_loss
11+
from Stocks
12+
group by stock_name

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /