$query="SELECT e.descr,b.succ_count,c.fail_count,c1.noa_count,d.static_count,b.succ_count/d.static_count*100 as succ_percent,c.fail_count/d.static_count*100 as fail_percent,c1.noa_count/d.static_count*100 as noa_percent,b.sum_time,b.sum_time/b.succ_count as avg_time,sum_pd,sum_pd/static_count as avg_pd, b.l1, b.l2, c1.l3, c1.l4, c4.p5, c4.p10, c4.p20, c4.p30, c4.p60,z.dst from ";
$query .="((select dst,sum(duration-billsec) as sum_pd from asteriskcdrdb.cdr where $strWhere group by dst) as z left outer join ";
$query.="( select dst,max(duration-billsec) as l1,min(duration-billsec) as l2,count(*) as succ_count,sum(billsec) as sum_time from asteriskcdrdb.cdr where $strWhere and disposition='ANSWERED' group by dst) as b on b.dst=z.dst left outer join ";
$query.="(select dst,count(*) as fail_count from asteriskcdrdb.cdr where $strWhere and (disposition='FAILED' or disposition='BUSY') group by dst) as c on b.dst=c.dst left outer join ";
$query.="(select dst,max(duration-billsec) as l3,min(duration-billsec) as l4,count(*) as noa_count from asteriskcdrdb.cdr where $strWhere and disposition='NO ANSWER' and duration>0 group by dst) as c1 on b.dst=c1.dst left outer join ";
$query.=" (select e1.dst,m5_count/mz_count*100 as p5,m10_count/mz_count*100 as p10,m20_count/mz_count*100 as p20,m30_count/mz_count*100 as p30,m60_count/mz_count*100 as p60 from ((select dst,count(*) as mz_count from asteriskcdrdb.cdr where $strWhere and disposition='ANSWERED' group by dst) as e1 left outer join (select dst,count(*) as m10_count from asteriskcdrdb.cdr where $strWhere and disposition='ANSWERED' and duration-billsec<=10 group by dst) as e2 on e1.dst=e2.dst left outer join (select dst,count(*) as m20_count from asteriskcdrdb.cdr where $strWhere and disposition='ANSWERED' and duration-billsec<=20 group by dst) as e3 on e1.dst=e3.dst left outer join (select dst,count(*) as m30_count from asteriskcdrdb.cdr where $strWhere and disposition='ANSWERED' and duration-billsec<=30 group by dst) as e4 on e1.dst=e4.dst left outer join (select dst,count(*) as m60_count from asteriskcdrdb.cdr where $strWhere and disposition='ANSWERED' and duration-billsec<=60 group by dst) as e5 on e1.dst=e5.dst left outer join (select dst,count(*) as m5_count from asteriskcdrdb.cdr where $strWhere and disposition='ANSWERED' and duration-billsec<=5 group by dst) as e6 on e1.dst=e6.dst) ) as c4 on b.dst=c4.dst ";
$query.=" ,( SELECT dst,count(*) as static_count from asteriskcdrdb.cdr where $strWhere and duration>0 group by dst) as d ),(select * from asterisk.queues_config) as e where z.dst=d.dst and z.dst=e.extension and z.dst<>'601' and z.dst<>'606'";
我也知道这是查询语句,各位大侠不需要说明每一句话的意思只要告诉我这样的sql语句的大致意思.