select a.id,count(*) count from a join b ON a.id = b.id
换成
select a.id,b.count from a join (select count(*) count from b) b on a.id = b.id
本文介绍了一种SQL查询优化技巧,通过使用子查询来减少连接操作中的计数计算,提高数据库查询效率。
select a.id,count(*) count from a join b ON a.id = b.id
换成
select a.id,b.count from a join (select count(*) count from b) b on a.id = b.id
467
1068
1482
5953
3067

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