We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eb08b08 commit 0434c9cCopy full SHA for 0434c9c
MySQL/odd-and-even-transactions.sql
@@ -0,0 +1,9 @@
1
+# Time: O(nlogn)
2
+# Space: O(1)
3
+
4
+SELECT transaction_date,
5
+ SUM(IF(amount%2 != 0, amount, 0)) AS odd_sum,
6
+ SUM(IF(amount%2 = 0, amount, 0)) AS even_sum
7
+FROM transactions
8
+GROUP BY 1
9
+ORDER BY 1;
0 commit comments