views:

29

answers:

1
SELECT COUNT(*)
FROM dbo.Table WITH (NOLOCK)
WHERE 
 Columnn1 IN (1,2) AND
 Column2 IN 
  (SELECT id FROM dbo.Table2 WHERE id2 = 5 AND id3 = 1) AND
 id4 = 8
A: 
Context.Table.Count<TableObject>(t => t.id4 == 8 &&
                                      (t.Column1 == 1 || t.Column1 == 2) &&
                                      Context.Table2.Count<Table2Object>(t2 => t2.id2 == 5 && t2.id3 == 1 && t2.id == t.id) > 0);

where TableObject and Table2Object are whatever you named the entities coming from Table and Table2, respectively.

Andrew