1.组合表查询
select a.* from test1 a test2 b where a.colume = b.colume and ...
2.复合查询
select a.* from test1 a where a.colume = (select b.colume from test2 b where ...)
假定两条语句都能正确执行!!!!
...全文
39811打赏收藏
两种SQL查询哪个效率高点????
1.组合表查询 select a.* from test1 a test2 b where a.colume = b.colume and ... 2.复合查询 select a.* from test1 a where a.colume = (select b.colume from test2 b where ...) 假定两条语句都能正确执行!!!!
2的效率高,同意楼上的。
理由:
如果select a.* from test1 a where a.colume = (select b.colume from test2 b where ...)能正确执行,说明(select b.colume from test2 b where ...)子查询返回的结果是唯一的!
理由:
如果select a.* from test1 a where a.colume = (select b.colume from test2 b where ...)能正确执行,说明(select b.colume from test2 b where ...)子查询返回的结果是唯一的!
-------------------
支持