1193. Monthly Transactions I - LeetCode SQL Solution [MySQL]

preview_player
Показать описание
Today I solve and explain a medium level difficulty leetcode SQL problem using MySQL called "1193. Monthly Transactions I"

If you found this helpful Like and Subscribe! I solve LeetCode Algorithms and SQL Problems daily!

#leetcode #mysql #sql #tutorial #SQLinterviewQuestions #LeetCodeSQL #FAANG #coding #programming
Рекомендации по теме
Комментарии
Автор

wow this is completely different than what I did..your code is so much simple than the indians..
select
date_format(trans_date, '%Y-%m') as month,
country,
count(*) as trans_count,
sum(case when state = 'approved' then 1 else 0 end) as approved_count,
sum(amount) as trans_total_amount,
sum(case when state = 'approved' then amount else 0 end) as approved_total_amount
from
Transactions
group by month, country

containthis
welcome to shbcf.ru