1
我必須計算group by子句中的百分比。 更深入我需要計算Status ='False'的ControlForms的百分比。狀態位於表checkResult中。Linq查詢與組通過檢索百分比
var items = (from controlForm in dataContext.ControlForms
join controlFormStatus in dataContext.ControlFormStatus on controlForm.FK_ControlFormStatus equals controlFormStatus.Id
join docCheck in dataContext.DocumentChecks on controlForm.Id equals docCheck.FK_ControlForm
join checkResult in dataContext.CheckResults on docCheck.FK_CheckResult equals checkResult.Id
where controlForm.FK_ControlCycle.ToString().Equals(controlCycleId) & (
controlFormStatus.Description.Equals(Constants.ControlFormStatusTestControlOwner)
| controlFormStatus.Description.Equals(Constants.ControlFormStatusApprovalProcessOwner))
group controlForm by new { controlForm.Id, controlForm.FK_ControlCycle, controlForm.FK_SampleNode, controlForm.FK_Control, /*FUNCTION*/} into ctrlForm
select new ControlFormReportPartialResults(ctrlForm.Key.Id, ctrlForm.Key.FK_ControlCycle, ctrlForm.Key.FK_SampleNode, ctrlForm.Key.FK_Control, ValueFunction));
任何人都可以建議我什麼,我不得不但是istead/功能 /?或者如果有另一種方法來解決問題? 任何幫助真的很受歡迎!
由於提前, 達里奧扎內利