• When I try this I get an error:

    SELECT Regions.Description, COUNT(oh.id) AS TotalOrders, SUM(CASE WHEN (ISNULL(oh.timedorder,0) = 0) THEN 1 ELSE 0 END) AS TotalASAP, SUM(CASE WHEN (oh.timedorder = -1) THEN 1 ELSE 0 END) AS TotalNOASAP, SUM(CASE WHEN (isnull(oh.quote_minutes,0) <=59) AND ISNULL(oh.timedorder,0) THEN 1 ELSE 0 END) AS fiftymins, SUM(CASE WHEN (oh.quote_minutes >= 60 AND oh.quote_minutes <= 69) AND ISNULL(oh.timedorder,0) THEN 1 ELSE 0 END) AS sixtymins, SUM(CASE WHEN (oh.quote_minutes >= 70 AND oh.quote_minutes <= 79) AND ISNULL(oh.timedorder,0) THEN 1 ELSE 0 END) AS seventymins, SUM(CASE WHEN (oh.quote_minutes >= 80 And oh.quote_minutes <= 89) AND ISNULL(oh.timedorder,0) THEN 1 ELSE 0 END) AS eightymins, SUM(CASE WHEN (oh.quote_minutes >= 90 AND ISNULL(oh.timedorder,0) THEN 1 ELSE 0 END) AS plusninetymins, FROM OrderHeader oh LEFT OUTER JOIN Address ON Address.ID=OH.AddressID LEFT OUTER JOIN Zones ON Zones.ID = Address.Zone LEFT OUTER JOIN Regions ON Regions.ID = Zones.RegionID Where (oh.OrderType = 1) AND (oh.date_delivery >= '03/01/2003') AND (oh.date_delivery <= '03/31/2003') AND (oh.companyid = 1154) AND (oh.time_targetdelivery <= '3:00:00 PM') GROUP BY Regions.ID, Regions.DescriptionORDER BY Regions.Description

    The erorr is INCORRECT SYNTAX NEAR THE KEYWORD 'THEN'