当前位置: 代码迷 >> Sql Server >> 同志们帮忙优化个SQL话语,谢了
  详细解决方案

同志们帮忙优化个SQL话语,谢了

热度:77   发布时间:2016-04-27 11:44:09.0
同志们帮忙优化个SQL语句,急,谢了啊
SQL code
SELECT  V_APPROVAL_WORK_ITEM.ENTITY_NAME ,        V_APPROVAL_WORK_ITEM.ENTITY_NO ,        V_APPROVAL_WORK_ITEM.SUMMARY ,        ENTITY_WF_INST.START_DATE ,        V_APPROVAL_WORK_ITEM.ENTITY_ID ,        V_APPROVAL_WORK_ITEM.ENTITY_TYPE ,        V_APPROVAL_WORK_ITEM.FLOW_TYPE,MIN(APPROVAL_NO),MIN(CATE_APPROVAL_NO)FROM    dbo.V_APPROVAL_WORK_ITEM        INNER JOIN dbo.ENTITY_WF_INST ON dbo.V_APPROVAL_WORK_ITEM.ENTITY_TYPE = dbo.ENTITY_WF_INST.ENTITY_TYPE AND dbo.V_APPROVAL_WORK_ITEM.ENTITY_ID = dbo.ENTITY_WF_INST.ENTITY_IDWHERE   CUR_USER_ID = 29        AND APPROVAL_NO IN (        SELECT  MIN(APPROVAL_NO)        FROM    V_APPROVAL_WORK_ITEM a        WHERE   a.Entity_ID = V_APPROVAL_WORK_ITEM.Entity_ID                AND a.Entity_TYPE = V_APPROVAL_WORK_ITEM.ENTITY_TYPE )        AND CATE_APPROVAL_NO IN (        SELECT  MIN(CATE_APPROVAL_NO)        FROM    V_APPROVAL_WORK_ITEM a        WHERE   a.Entity_ID = V_APPROVAL_WORK_ITEM.Entity_ID                AND a.ENTITY_TYPE = V_APPROVAL_WORK_ITEM.ENTITY_TYPE )GROUP BY V_APPROVAL_WORK_ITEM.ENTITY_NAME ,        V_APPROVAL_WORK_ITEM.ENTITY_NO ,        V_APPROVAL_WORK_ITEM.SUMMARY ,        ENTITY_WF_INST.START_DATE ,        V_APPROVAL_WORK_ITEM.ENTITY_ID ,        V_APPROVAL_WORK_ITEM.ENTITY_TYPE ,        V_APPROVAL_WORK_ITEM.FLOW_TYPEORDER BY dbo.ENTITY_WF_INST.START_DATE DESC


------解决方案--------------------
最多把where中子查询改成连接来处理,说不定会快些.
  相关解决方案