A:
select a.account_number, t.sales,t.time
from Account a
join
(
select account_id, SUM(sales) sales, min(trans_time) time
from trans
group by account_id
having sum(sales)>1000
) t on a.account_id=t.account_id
B:
select a.account_number, SUM(t.sales) sales, min(t.trans_time) time
from Account a
JOIN trans t on a.account_id=t.account_id GROUP BY account_number having sum(t.sales)>1000
数据量大的话A和B两种写法性能有区别吗?
- 3 回答
- 0 关注
- 519 浏览
添加回答
举报
0/150
提交
取消