title: Query Linq Join Many to Many
body: <p>I'm using Linq-SQL Entity for my MVC2 Application.</p>
  
  <p>I have those tables / entities</p>
  
  <blockquote>
    <p>Person ( ID , Name , Surname ) 
    Car (ID , Model , Name) 
    Reseller ( ID , Name)</p>
  </blockquote>
  
  <p>And i have those 2 Many to Many Tables</p>
  
  <blockquote>
    <p>Persons_Cars ( ID , ID_Person , ID_CAR) Persons_Resellers ( ID,
    ID_Person, ID_Reseller)</p>
  </blockquote>
  
  <pre><code> public MyModel {
  
     //Some Fields
  
      public List&lt;CarPerson&gt; carList;
  
      public CarPerson 
      {
        String detail;
        int id;
      }
  }
   var query=(from person in data.Person
  
                       join PerCar in data.Persons_Cars on person.ID equals Persons_Cars.ID_Person into JoinedPerCar
                       from PerCar in JoinedPerCar.DefaultIfEmpty()
  
                       join car in data.car on PerCar .id_car equals car.ID into JoinedCarPe
  rson
                       from car in JoinedCarPerson.DefaultIfEmpty()
  
                       join PerReseller in data.Persons_Resellers on person.ID equals  PerReseller .id_person into JoinedPersReseller 
                       from PerReseller in JoinedPersReseller.DefaultIfEmpty()
  
                       join Reseller in data.Reseller on PerReseller.id_reseller equals Reseller.ID into JoinedResellerPers
                       from Resller in JoinedFormazioneComp.DefaultIfEmpty()
  
                       where person.ID_USER == USER.ID 
                       select new MyModel
                                  { 
                                       carList = JoinedPerCar.Select(m=&gt;new CarPerson {detail=m.car.Model,id = m.ID}).ToList()},
                                  //Other
                                  });
  </code></pre>
  
  <p>I know that it's totally wrong but i'm new into Linq-SQL
  I have a problem now :</p>
  
  <p>The Query works but my result is wrong. Infact if a person has 2 cars i recive the same person two times with 2 list of the cars.</p>
  
  <p>Example </p>
  
  <p>Mr Brown has 2 Cars 
  i Recive 
  Mr Brown ---> List of car(Car1 , Car2)
  Mr Brown ---> List of car(Car1,  Car2)</p>
  
  <p>So i need that if a person has 2 car i get only 1 result of person with his own cars</p>
  
  <p>Is there a way to write this query better ?
  How could resolve my problem?</p>
  
  <p>Thanks</p>