这一般是什么原因造成的?
两个几乎一样的语句.第一条记录少些,执行的时间反而长些.
The break point is set in private void BindData, same place. I record two queries:
SELECT ch.ProjectId,
p.ProjectName,
ch.CompanyName,
ch.CompanyId,
COUNT(DISTINCT EmployeeId) AS TotalWorkers,
SUM(rhw + ohw + dhw) AS TotalHours,
SUM(rhw * rRate + ohw * Orate + dhw * dRate) AS LaborCost
FROM cprHeader ch,
cprWeekly cw,
cprHourly HOUR,
Projects p
WHERE ch.cprHeadeRid = cw.cprHeadeRid
AND HOUR.cprWeeklyId = cw.cprWeeklyId
AND ch.ProjectId = p.ProjectId
AND cw.EmployeeId <> 0
AND ch.ActiveRecord = 1
AND ch.IsDraft = 0
AND cw.ActiveRecord = 1
AND ch.ProjectId IN (150,178,159,174,158)
AND ch.CompanyId IN (304,332,370,307,288)
AND (Substring(cw.CraftCode,11,1) = 0
OR Substring(cw.CraftCode,11,1) = 1)
AND (HOUR.DateWorked BETWEEN CAST( '3/30/2005 ' AS DATETIME)
AND CAST( '4/5/2007 ' AS DATETIME))
AND HOUR.rhw + HOUR.ohw + HOUR.dhw <> 0
GROUP BY ch.ProjectId,p.ProjectName,ch.CompanyId,ch.CompanyName
SELECT &n