I'm having a problem translating a where clause that contains a select statement to LINQ-to-SQL. Here is the SQL snippet:
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%')
Specifically, I'm having trouble with:
WHERE
(p.prioid IS NULL
OR p.prioid IN (SELECT prioid FROM mc.PRIORITY WITH (NOLOCK) WHERE prioid LIKE '1%' ))
I translated it into the following LINQ statement, but I'm sure it's incorrect:
where (p.prioid = null || p.prioid == "1%")