title: Lambda / LINQ find relations between multiple many-to-many relationship SQL tables
body: <p>I'm working on a school project, where the objective is to create a system which can handle multiple laundries with the appropriate features like making a reservation for a laundry machine, user handling etc.</p>
  
  <p>I have the following design:</p>
  
  <p><a href="https://i.stack.imgur.com/mubEQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mubEQ.jpg" alt="enter image description here"></a></p>
  
  <p>One of the assignments is to iterate through all of my laundries and show how many reservations have been made on all of the laundry machines in each laundry. I'm stuck trying to find identical relationship between my reservation table and <code>laundrymachine</code> table.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>var queryList = (from laundry in _db.Laundries
                   join laundryMachine in _db.LaundryMachines on laundry.LaundryID equals laundryMachine.LaundryID
                   join res in _db.Reservations on laundryMachine.Reservations.Where(x =&gt; x.LaundryMachines.Select(z =&gt; z.MachineID) == res.MachineID)
                   select laundry).ToList();
  </code></pre>
  
  <p>But not sure how to proceed. How do I find identical rows in a many-to-many relationship?</p>