java吧 关注:1,291,652贴子:12,821,250
  • 1回复贴,共1

求助 关于sql语句

只看楼主收藏回复

select a.bugId from BugTrack a where delFlag='1' and exists(select 1 from BugTrack where bugId = a.bugId and delFlag='1' group by bugId having a.resolvedDate=max(resolvedDate))
select a.bugId from BugTrack a where delFlag='1' and not exists(select 1 from BugTrack where bugId = a.bugId and delFlag='1' and resolvedDate>a.resolvedDate)
这两个sql语句哪一个查询效率更高 数据非常多的情况下


IP属地:广东1楼2016-11-11 10:12回复
    你这么多子查询效率肯定低


    3楼2016-11-11 10:14
    回复