我在LinqPad V4.42.14(AnyCPU)上运行以下linq查询时收到错误:ORA-00933: SQL command not properly ended
,数据库是Oracle 11g。
如果我更换
where coof.CoofCode == tod.PatTrnsplntFail.CoofCode && coof.OrgCode == prod.OrgCode
到
where coof.CoofCode == tod.PatTrnsplntFail.CoofCode
它有效,但我不能删除那个因素。
任何身体都可以帮助我,我将非常感激。
void Main()
{
var q = (from pat in Pats
from patr in pat.PatRegisters
from prod in patr.PatRegisterOrgDets
from tod in prod.TransplantOrgDets
select new {
PatId = pat.PatID,
FullName = pat.FirstName + ", " + pat.LastName,
RegisterDate = patr.RegDate.ToString("yyyy-MMM-dd"),
TransplantDate = tod.Transplant.TransplantDate.ToString("yyyy-MMM-dd"),
OrganSpec = tod.OrgSpec.Descrip,
IsTransplantedFailed = tod.PatTrnsplntFail.TodID == 0 ? false: true,
TransplantedFailReason = from coof in CausesOfOrgFail
where coof.CoofCode == tod.PatTrnsplntFail.CoofCode && coof.OrgCode == prod.OrgCode
select coof.Descrip
}).Distinct().OrderBy(o => o.PatId);
q.Dump(true);
}
答案 0 :(得分:0)
void Main()
{
var q1 = (from pat in Pats
from patr in pat.PatRegisters
from prod in patr.PatRegisterOrgDets
from tod in prod.TransplantOrgDets
where tod.PatTrnsplntFail.TodID == null
select new {
PatId = pat.PatID,
FullName = pat.FirstName + ", " + pat.LastName,
RegisterDate = patr.RegDate.ToString("yyyy-MMM-dd"),
TransplantDate = tod.Transplant.TransplantDate.ToString("yyyy-MMM-dd"),
OrganSpec = tod.OrgSpec.Descrip,
IsTransplantedFailed = false,
CausesOfOrgFailReason = ""
}).Distinct().OrderBy(o => o.PatId);
var q2 = (from pat in Pats
from patr in pat.PatRegisters
from prod in patr.PatRegisterOrgDets
from tod in prod.TransplantOrgDets
from coof in CausesOfOrgFail where coof.CoofCode == tod.PatTrnsplntFail.CoofCode && coof.OrgCode == prod.OrgCode
where tod.PatTrnsplntFail.TodID != null
select new {
PatId = pat.PatID,
FullName = pat.FirstName + ", " + pat.LastName,
RegisterDate = patr.RegDate.ToString("yyyy-MMM-dd"),
TransplantDate = tod.Transplant.TransplantDate.ToString("yyyy-MMM-dd"),
OrganSpec = tod.OrgSpec.Descrip,
IsTransplantedFailed = true,
CausesOfOrgFailReason = coof.Descrip
}).Distinct().OrderBy(o => o.PatId);
q1.ToList().Union(q2.ToList()).OrderBy(o => o.PatId).Dump(true);
}