1
這可以做w/linqtosql嗎?linqtosql,時間跨度,聚合......可以完成嗎?
SELECT City, SUM(DATEDIFF(minute,StartDate,Completed)) AS Downtime
FROM Incidents
GROUP BY City
這可以做w/linqtosql嗎?linqtosql,時間跨度,聚合......可以完成嗎?
SELECT City, SUM(DATEDIFF(minute,StartDate,Completed)) AS Downtime
FROM Incidents
GROUP BY City
using System.Data.Linq.SqlClient;
db.Incidents
.GroupBy(i => i.City)
.Select(g => new
{
City = g.Key,
DownTime = g.Sum(i => SqlMethods.DateDiffMinute(i.StartDate, i.Completed))
});
是。你必須使用SqlMethods類。