title: Selecting all x which are in y table
body: <p>I have table of users and cities. I want to get list of all cities that are in users collection so that I can acces to all cities id;</p>
  
  <pre><code>    public class City
  {
      public int ID { get; set; }
      public string Name { get; set; }
  
      public virtual ICollection&lt;ApplicationUser&gt; AppUserID { get; set; }
      public virtual ICollection&lt;Measurement&gt; Measurements { get; set; }
  }
     public class ApplicationUser : IdentityUser
  {
      public override string Id { get; set; }
      public virtual ICollection&lt;City&gt; Cities { get; set; }
  }
  </code></pre>
  
  <p>I have already tried </p>
  
  <pre><code>var cities = db.Cities.Where(c =&gt; c.AppUserID != null ); //and with .ToList()
  
  var cities = from city in db.Cities
                       join user in db.Users
                       on city.AppUserID equals user.Cities
                       select city.ID;
  </code></pre>
  
  <p>but it doesn't work. 
  Any solutions?
  Thanks in advance.</p>