title: Linq Get Data Based On Single Column Value
body: <p>I want to get the job count based on gender by relation database.</p>
  
  <p>1st Table - Persons</p>
  
  <pre><code>PersonID  PersonName Gender
  1         Anand      Male
  2         sam        Male
  3         Mary       Female
  </code></pre>
  
  <p>2nd Table - Jobs</p>
  
  <pre><code>JobID    Job     PersonID
  1        x        1
  2        y        3
  3        z        1
  4        a        2
  </code></pre>
  
  <p>Required output</p>
  
  <pre><code>Gender   JobCount
  Male     3
  Female   1 
  </code></pre>
  
  <p>My model</p>
  
  <pre><code>public class value
  {
      public string Gender {get;set;}
      public int JobCount {get;set;}
  }
  </code></pre>
  
  <p>My code</p>
  
  <pre><code>var data = from t1 in db.Persons
            join t2 in db.Jobs on t1.PersonID equals t2.PersonID into PersonJob
            select new value { Gender = t1.Gender , JobCount = PersonJob.Count()};
  </code></pre>
  
  <p>but it doesn't give the required output.  </p>