日期:2014-05-16  浏览次数:20923 次

请高手帮忙优化一条SQL
select d.c2,sum(c.num1) sum1 from (select a.co,a.c11*a.c19 num1 from (select co,c7,c8,c11,c16,c19 from ST22014_main a where c1=(select max(c1) c1 from ST22014_main )) a join (select distinct(c2) c2 from ST22032_main where c4='15' union all select distinct(c2) c2 from ST22032_main where c4='14') b on a.c7=b.c2) c join ST1209_main d on c.co=d.co group by d.c2


表情况:
http://tu.6.cn/pic/play-tu/id/0#13931828
http://tu.6.cn/pic/play-tu/id/0#13931829

请各位高人指教啊,在线等解答!!!

------解决方案--------------------
描述一下你想实现的功能吧。 这样别人就不需要去分析理解你的SQL语句了。
------解决方案--------------------
方法就是拆成多个sql慢慢找慢的sql
------解决方案--------------------
创建 c4 的索引。