`
tw370277670
  • 浏览: 1920 次
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

求助,帮忙做下这个sql语句的优化

阅读更多
现在这个sql查询要7秒!
太慢了,求优化....

SELECT 
(SELECT c1.name from weather_phenomenons c1 where c1.code=a.one_code) one_name,
(SELECT c2.name from weather_phenomenons c2 where c2.code=a.two_code) two_name,
(SELECT c1.image from weather_phenomenons c1 where c1.code=a.one_code) image,
(SELECT c2.image from weather_phenomenons c2 where c2.code=a.two_code) image1,
(SELECT t.info_title from infos t where t.info_type=106 and info_status=3 order by info_time desc limit 1)title,
a.low_temperature,a.high_temperature,a.weather_day,
c.sname,c.t,c.pr1,c.wd,c.ws,c.wet 
FROM weathers a,cities b,sc_realtime_weathers c 
where a.area_key=b.city_key and c.sid=b.code AND a.weather_day between'2012-02-16' and '2012-02-19' and c.st='2012-02-16 18:00:00'and (c.sname like'绵阳%' or b.code='绵阳' or b.phoneticize='绵阳')
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics