首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

请高手帮忙优化一条SQL,该怎么解决

2012-03-26 
请高手帮忙优化一条SQLselect d.c2,sum(c.num1) sum1 from (select a.co,a.c11*a.c19 num1 from (select c

请高手帮忙优化一条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 的索引。

热点排行