请大家帮忙sql语句调优 谢谢
INSERT INTO temp1000all
SELECT
ISNULL(SUM(tempRe.rebateValue * ra.RateValue / 10000 * af.dcBalance),0)
,ISNULL(SUM(tempRe.rebateValue * ra.RateValue / 10000 * af.dcavgbalance1),0)
,ISNULL(SUM(tempRe.rebateValue * ra.RateValue / 10000 * af.dcaddbalance1),0) as cshqsdjnc
,ISNULL(SUM(tempRe.rebateValue * ra.RateValue / 10000 * af.dcaddbalance2),0) as cshqsdjjm
,ISNULL(SUM(tempRe.rebateValue * ra.RateValue / 10000 * af.dcaddbalance3),0) as cshqsdjym
,ISNULL(SUM(tempRe.rebateValue * ra.RateValue / 10000 * af.dcaddavgbalance1),0) as cshqrjjnc
,ISNULL(SUM(tempRe.rebateValue * ra.RateValue / 10000 * af.dcaddavgbalance2),0) as cshqrjjjm
,ISNULL(SUM(tempRe.rebateValue * ra.RateValue / 10000 * af.dcaddavgbalance3),0) as cshqrjjym
,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0
,0,0,0,0,am.name,amg.name,am.id,amg.id
FROM Rate ra
LEFT JOIN Am_Amg_Rel aar ON aar.id = ra.am_amg_id
LEFT JOIN AccountFull af ON af.caccountNo = ra.accountNo
LEFT JOIN temp1000Rebate tempRe ON tempRe.accountNo = af.caccountNo
LEFT JOIN AccountManager am ON am.id = aar.amid
LEFT JOIN AccountManagerGroup amg ON amg.id = aar.amgid
WHERE af.cDate = '20090621'
AND af.ncustomerid <> 0
AND af.ncustomerid IS NOT NULL
AND af.citemcode IN(20202,21101,21102,21103,21104,21702)
GROUP BY am.id, amg.id, am.name, amg.name ,af.citemcode