我在将包含 select 语句的 where 子句转换为 LINQ-to-SQL 时遇到问题。这是 SQL 片段:
WHERE
(p.prioid IS NULL
OR p.prioid IN (SELECT prioid FROM mc.PRIORITY WITH (NOLOCK) WHERE prioid LIKE '1%' ))
AND s.id IN(@site)
AND (LTRIM(sv.glseg) IN ('703', '704', '705'))
AND (c.crewid IS NULL
OR c.crewid IN (SELECT crewid FROM mc.CREW WITH (NOLOCK) WHERE crewid NOT LIKE '2-%'
AND (crewid LIKE '%MAINT%'
OR crewid LIKE '%ELECT%'
OR crewid LIKE '%INST%')))
AND wot.id IN (SELECT id FROM mc.WORKORDERTYPE WITH (NOLOCK) WHERE id NOT LIKE '%Standing%')
具体来说,我遇到了以下问题:
WHERE
(p.prioid IS NULL
OR p.prioid IN (SELECT prioid FROM mc.PRIORITY WITH (NOLOCK) WHERE prioid LIKE '1%' ))
我将它翻译成以下 LINQ 语句,但我确定它是不正确的:
where (p.prioid = null || p.prioid == "1%")