您的位置:首页 > 数据库

Sql 一个SQL语句的优化

2011-12-07 14:10 281 查看
这是一个sql语句优化的过程。使用子查询与不使用子查询的效率对比

select sum(sl0000) from xstfxps2 where
  dhao00 in (
  select dhao00 from xstfxps1 where trunc(ywrq00)=trunc(sysdate)
  and khdm00='500000003913');
已用时间: 00: 02: 49.04

select sum(sl0000)
  from xstfxps2 a,(select dhao00 from xstfxps1 where trunc(ywrq00)=trunc(sysdate)
  and khdm00='500000003913') b
  where a.dhao00=b.dhao00;
已用时间: 00: 00: 03.05
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐