title: Joining 4 tables in mysql giving me duplicate records
body: <p>I want to join below 4 tables (leads, categories, sales_persons, website_assigns) in mysql query :</p>
  
  <p><strong>Required</strong> : i need lead id and lead record  but its not sure that category , sales person exist for that lead,
  If they category and sales person exist then come otherwise no required means null.</p>
  
  <p>There is no relation between leads and sales_person direct, they bind with third table which is website_assign</p>
  
  <p><strong>MySql Query:</strong></p>
  
  <pre><code>SELECT a.id, a.name, b.name, c.first_name, c.last_name
  FROM leads a INNER JOIN sales_persons c
  LEFT JOIN categories b ON a.category_id = b.id
  LEFT JOIN website_assigns d ON a.id = d.lead_id and c.id = d.sales_person_id
  </code></pre>
  
  <p>This above query giving me repeated record of leads, category and sales person table</p>
  
  <p><strong>Tables:</strong></p>
  
  <pre><code>leads:
  id  |   name | category_id
   1      xyz     12
   2      abc     13
   3      def     14
   4      gty     15
   5      wer     16
  
  categories:
  id  |   name
  12      grocery
  13      cloths
  14      books
  15      travel
  16      furniture
  
  
  sales_persons:    
  id  | first_name | last_name
  
  111     Jack        Soloman
  112     Peris       Rock
  113     Pull        Cha
  114     Tim         shock
  
  
  website_assigns:
  id  | lead_id | sales_person_id
  1       1           112
  2       1           114
  3       2           113
  4       2           111
  5       3           113
  6       3           112
  7       3           114
  </code></pre>
  
  <p><strong>Duplicate record screen shot attached:</strong></p>
  
  <p>See repeated id (Lead id) , name (category name), first name and last  name of sales_person coming,</p>
  
  <p>But 4847, 5868 has only sales person assigned.</p>
  
  <p>In screen shot leadsite_assign is same table website_assign.
  So ignore the name of table.</p>
  
  <p><a href="https://i.stack.imgur.com/zu3id.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zu3id.png" alt="enter image description here"></a></p>