Can this be done w/ linqtosql?
SELECT City, SUM(DATEDIFF(minute,StartDate,Completed)) AS Downtime FROM Incidents GROUP BY City
Can this be done w/ 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))
});