SELECT
Wot.WorkOrderType,
COUNT(CASE WHEN Wo.Status = 'C' THEN 1 END) as [Completed],
COUNT(CASE WHEN Wo.Status = 'E' THEN 1 END) as [Error]
FROM WorkOrder_2002 Wo
INNER Join WorkOrderType Wot ON Wo.WorkOrderTypeId= wot.Id
WHERE Wo.CreateTime BETWEEN '2012-04-01' AND '2012-05-15'
GROUP BY Wo.WorkOrderTypeId,Wot.WorkOrderType
ORDER BY Wo.WorkOrderTypeId,Wot.WorkOrderType
我想使用上述查询通过 ADO.NET 检索记录(我想在 SqlCommand 中传递此查询)。我想在 where 子句中传递两个日期。