g3201_3300.s3220_odd_and_even_transactions.script.sql Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java21 Show documentation
Show all versions of leetcode-in-java21 Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
# Write your MySQL query statement below
# #Medium #Database #2024_07_23_Time_248_ms_(85.85%)_Space_0B_(100.00%)
select transaction_date,
sum(case when amount%2<>0 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 asc;