0
http://img7.imageshack.us/img7/3050/downtime.png동적 LinqToSQL 피벗 테이블 쿼리
나는 (과에서) 두 개의 달력 선택기가 나는 YEAR1 구축 할 필요가 -> 4이 동적으로합니다. 나는 또한 2006 년과 2009 년 동안 가치가있는 1 개의 항목에 대한 이중 기록을 얻고 있습니다. 그들이 원한다면 그들은 100 년을 선택할 수 있습니다. 첨부 된 이미지를 확인하십시오.
public ActionResult DownTimeSummaryTabular(int Start,int End)
{
var q = from item in new iSppms.Models.iSppmsDataContext().Incidents
group item by new
{
item.Supplier.Id,
item.Supplier.Name,
item.SupplierPlant,item.DownTime
}
into supplier
select new
{
SupplierId = supplier.Key.Id,
SupplierName = supplier.Key.Name,
SupplierPlant = supplier.Key.SupplierPlant.Plant,
Years = from incident in supplier
let year = incident.IncidentDate.Year
where year <= End and year >= Start
group incident by year into incidentForYear
select incidentForYear.DownTime
};
return View();
}
hmmm 코드에 오류가 있습니까? –
연도 <끝과 연도> = 시작 –
선택 incident.DownTime.ToIntOrDefault() –