编写一个解决方案来查找每天 奇数 交易金额和 偶数 交易金额的 总和。如果某天没有奇数或偶数交易,显示为 0。

select transaction_date,
sum(case when amount%2 != 0 then amount else 0 end) odd_sum,
sum(case when amount%2 = 0 then amount else 0 end) even_sum
from transactions
group by transaction_date
order by transaction_date asc
932

被折叠的 条评论
为什么被折叠?



