Keith,
 
As requested..................

Mat



 -----Original Message-----
From: 	Woodstrom, David  
Sent:	Monday, May 07, 2001 10:33 AM
To:	Smith, Matt
Subject:	outage summary

 

SELECT DISTINCT Calendar.DateValue As OutageDate,

 SUM(CASE PlantChar.WSCCRegion WHEN 'DSW' THEN
       CASE UnitChar.Fuel_designation WHEN 'Alt' THEN
         CASE PlantOutage.OutageReason WHEN 'forced' THEN
          PlantOutage.CapacityOut
         ELSE 0 END
      ELSE 0 END
    ELSE 0 END)/24 AS 'DSW|Alt|forced'

FROM LinkServer.Fundamentals.dbo.LkpCalendar_Definitions2 AS Calendar INNER JOIN LinkServer.Fundamentals.dbo.LkpOUT_PlantOutage AS PlantOutage
 ON Calendar.DateValue BETWEEN PlantOutage.BeginOutageDate AND PlantOutage.EndOutageDate
 INNER JOIN LinkServer.Fundamentals.dbo.LkpOUT_PlantCharacteristics AS PlantChar
 ON PlantOutage.PlantID = PlantChar.PlantID
 INNER JOIN LinkServer.Fundamentals.dbo.LkpOUT_UnitCharacteristics AS UnitChar
 ON PlantOutage.PlantUnitID = UnitChar.PlantUnitID

Where Calendar.DateValue Between @BeginDate AND @EndDate
 AND PlantOutage.Approved = 'Y'

Group By Calendar.DateValue 

ORDER BY Calendar.DateValue