日期:2014-05-18  浏览次数:20582 次

SQL 查询语句 超时已过期,如何优化????????????
SELECT FinDT, RoadNetID, RoadID, SubRoadID, StationID, CheckStation, InRoadNetID, 
  InRoadID, InSubRoadID, InStationID,
  (SELECT COUNT(*)
  FROM TC_OutList
  WHERE IsTruck = 1 AND Weight <= LimitLoad AND A.FinDT = FinDT AND 
  A.StationID = StationID AND A.RoadNetID = RoadNetID AND 
  RoadID = A.RoadID AND A.SubRoadID = SubRoadID AND 
  A.CheckStation = CheckStation AND A.InRoadNetID = InRoadNetID AND 
  A.InSubRoadID = InSubRoadID AND InStationID = A.InStationID) 
  AS OvTruCnt0,
  (SELECT COUNT(*)
  FROM TC_OutList
  WHERE IsTruck = 1 AND Weight > LimitLoad AND Weight <= LimitLoad * 1.3 AND 
  A.FinDT = FinDT AND A.StationID = StationID AND 
  A.RoadNetID = RoadNetID AND RoadID = A.RoadID AND 
  A.SubRoadID = SubRoadID AND A.CheckStation = CheckStation AND 
  A.InRoadNetID = InRoadNetID AND A.InSubRoadID = InSubRoadID AND 
  InStationID = A.InStationID) AS OvTruCnt1,
  (SELECT COUNT(*)
  FROM TC_OutList
  WHERE IsTruck = 1 AND Weight > LimitLoad * 1.3 AND 
  Weight <= LimitLoad * 1.5 AND A.FinDT = FinDT AND 
  A.StationID = StationID AND A.RoadNetID = RoadNetID AND 
  RoadID = A.RoadID AND A.SubRoadID = SubRoadID AND 
  A.CheckStation = CheckStation AND A.InRoadNetID = InRoadNetID AND 
  A.InSubRoadID = InSubRoadID AND InStationID = A.InStationID) 
  AS OvTruCnt2,
  (SELECT COUNT(*)
  FROM TC_OutList
  WHERE IsTruck = 1 AND Weight > LimitLoad * 1.5 AND 
  Weight <= LimitLoad * 2 AND A.FinDT = FinDT AND 
  A.StationID = StationID AND A.RoadNetID = RoadNetID AND 
  RoadID = A.RoadID AND A.SubRoadID = SubRoadID AND 
  A.CheckStation = CheckStation AND A.InRoadNetID = InRoadNetID AND 
  A.InSubRoadID = InSubRoadID AND InStationID = A.InStationID) 
  AS OvTruCnt3,
  (SELECT COUNT(*)
  FROM TC_OutList
  WHERE IsTruck = 1 AND Weight > LimitLoad * 2 AND A.FinDT = FinDT AND 
  A.StationID = StationID AND A.RoadNetID = RoadNetID AND 
  RoadID = A.RoadID AND A.SubRoadID = SubRoadID AND 
  A.CheckStation = CheckStation AND A.InRoadNetID = InRoadNetID AND 
  A.InSubRoadID = InSubRoadID AND InStationID = A.InStationID) 
  AS OvTruCnt4,
  (SELECT SUM(PayMoney)
  FROM TC_OutList
  WHERE IsTruck = 1 AND Weight <= LimitLoad AND A.FinDT = FinDT AND 
  A.StationID = StationID AND A.RoadNetID = RoadNetID AND 
  RoadID = A.RoadID AND A.SubRoadID = SubRoadID AND 
  A.CheckStation = CheckStation AND A.InRoadNetID = InRoadNetID AND 
  A.InSubRoadID = InSubRoadID AND InStationID = A.InStationID) 
  AS OvTruMny0,
  (SELECT SUM(PayMoney)
  FROM TC_OutList
  WHERE IsTruck = 1 AND Weight > LimitLoad AND Weight <= LimitLoad * 1.3 AND 
  A.FinDT = FinDT AND A.St