How do I convert the last row of this SQL to LINQ?
SELECT* FROM
ACOMPANHAMENTO A,
PRESOS_ACOMPANHAMENTO PA,
PRESOSS P
WHERE
P.ID_PRESOS = 300 AND
PA.ID_PRESOS = P.ID_PRESOS AND
A.ID_Acomp = PA.ID_Acomp AND
A.ID_Area_Acomp = 15 AND
A.ID_Sit_Acomp IN (SELECT SA.ID_Sit_Acomp FROM SITUACAO_ACOMPANHAMENTO SA WHERE SA.ST_Sit_Acomp = 'A')
The code below shows my attempt to convert SQL code to LINQ.
var resultado = (from a in contexto.ACOMPANHAMENTOes
from pa in contexto.PRESO_ACOMPANHAMENTO
from p in contexto.PRESOS
where p.ID_Preso == 300 &&
pa.ID_Preso == p.ID_Preso &&
a.ID_Acomp == pa.ID_Acomp &&
a.ID_Area_Acomp == 15 &&
a.ID_Sit_Acomp.ToString().Contains(from sa in contexto.SITUACAO_ACOMPANHAMENTO where sa.ST_Sit_Acomp == "A" select sa.ID_Sit_Acomp)
select a).ToList();