首页 > 数据库技术 > 详细

mysql 优化语句

时间:2016-12-16 12:22:09      阅读:255      评论:0      收藏:0      [点我收藏+]

优化前:

select b.type, ifnull(count(0),0) as qty from b_sell_quotationd a,b_sell_quotation b 
where b.quotationNo=a.quotationNo and a.status=‘N‘ and b.companycode=‘XXXXX‘ AND b.type=‘general‘;

优化后:


select  COUNT(0) from b_sell_quotationd a LEFT JOIN (SELECT * FROM b_sell_quotation WHERE type=‘general‘) b ON b.quotationNo=a.quotationNo WHERE b.companycode=‘XXXXXX‘ and a.status=‘N‘

mysql 优化语句

原文:http://4925054.blog.51cto.com/4915054/1883231

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!