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 b167f9a

Browse files
이지영: [SQL] Montly Transaction 1_250124
1 parent 2769e66 commit b167f9a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- 1193. Monthly Transactions I
2+
-- https://leetcode.com/problems/monthly-transactions-i/
3+
SELECT DATE_FORMAT(trans_date, "%Y-%m") AS month, country
4+
, COUNT(*) AS trans_count
5+
, COUNT(IF(state = 'approved', state, NULL)) AS approved_count
6+
, SUM(amount) AS trans_total_amount
7+
, SUM(IF(state = 'approved', amount, 0)) AS approved_total_amount
8+
FROM TRANSACTIONS
9+
GROUP BY YEAR(trans_date), MONTH(trans_date), country

0 commit comments

Comments
(0)

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