LeetCode solutions

3530. Odd and Even Transactions

My accepted SQL solution to LeetCode problem 3530, Odd and Even Transactions, running in 257ms.

  • Difficulty: Medium
  • SQL
  • Runtime 257ms
  • Memory 0.0B

Read the problem on LeetCode View on GitHub

SQL

Accepted on LeetCode — runtime 257ms, memory 0.0B, accepted 2026-01-02.

sql
SELECT 
    transaction_date,
        SUM(CASE WHEN amount % 2 = 1 THEN amount ELSE 0 END) AS odd_sum,
            SUM(CASE WHEN amount % 2 = 0 THEN amount ELSE 0 END) AS even_sum
            FROM transactions
            GROUP BY transaction_date
            ORDER BY transaction_date

Source