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子句中傳遞兩個日期。如何通過使用ADO.NET使用複雜查詢
您正在傳遞兩個日期。你真的在找什麼? – tzerb
我會根據開始日期和結束日期得到一些統計數據。我想通過使用gridview將這些統計信息顯示給用戶。 – Ranjith