优化前:
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‘
时间: 2024-11-05 19:03:49