title: Linq query with exist needed
body: <p>I am trying to write a LINQ query to get some data. The SQL query that I am trying to convert to LINQ is:</p>
  
  <pre><code>SET HApps = (SELECT COUNT(1) 
  FROM [App] r                                
  WHERE EXISTS (SELECT 1
        FROM AppStatus laa
                WHERE laa.AppID = r.AppID
        AND laa.AppCode = 3))
  </code></pre>
  
  <p>Is there any way to write Exist clause in LINQ?</p>
  
  <p>EDIT:
  My situation is little different then this answer because I have to get the count. I am trying to do something like this but it is not working</p>
  
  <pre><code>from r in
  (from r in context.App
    where
      (from laa in context.AppStatus
       where
         laa.AppId == r.AppId &amp;&amp; laa.AppId == 3
                                  select new
                                  {
                                      Column1 = 1
                                  }).FirstOrDefault().Column1 != null
                          select new
                          {
                              Column1 = 1,
                              Dummy = "x"
                          })
                      group r by new {r.Dummy}
                      into g
                      select new
                      {
                          Column1 = g.Count()
                      };
  </code></pre>