题目描述
leetcode题目:1587. 银行账户概要 II
Code
写法一
select name, sum(amount) as balance
from Users U
left join Transactions T
on U.account = T.account
group by U.account
having sum(amount) > 10000
写法二
select Users.name, balance
from Users
left join(select account, sum(amount) as balancefrom Transactionsgroup by account
) A
on A.account = Users.account
where balance > 10000