玩龙天子 发表于 2018-10-11 10:22:09

mysql 优化语句

  优化前:
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';
  优化后:
  selectCOUNT(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'


页: [1]
查看完整版本: mysql 优化语句