优化前:
1
2
|
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'
本文转自yunlielai51CTO博客,原文链接:http://blog.51cto.com/4925054/1883231,如需转载请自行联系原作者