title: Problem using MySQL Join
body: <p>i have a MySQL SELECT query which fetches data from 6 tables using Mysql JOIN. here is the MySQL query i am using.</p>
  
  <pre><code>SELECT
  u.id,u.password,
  u.registerDate,
  u.lastVisitDate,
  u.lastVisitIp,
  u.activationString,
  u.active,
  u.block,
  u.gender,
  u.contact_id,
  c.name,
  c.email,
  c.pPhone,
  c.sPhone,
  c.area_id,
  a.name as areaName, 
  a.city_id, 
  ct.name as cityName, 
  ct.state_id,
  s.name as stateName,
  s.country_id,
  cn.name as countryName
  FROM users u
  LEFT JOIN contacts c ON (u.contact_id = c.id)
  LEFT JOIN areas a ON (c.area_id = a.id)
  LEFT JOIN cities ct ON (a.city_id = ct.id)
  LEFT JOIN states s ON (ct.state_id = s.id)
  LEFT JOIN countries cn ON (s.country_id = c.id)
  </code></pre>
  
  <p>although query works perfectly fine it sometimes returns duplicate results if it finds any duplicate values when using LEFT JOIN. for example in contacts table there exist two rows with area id '2' which results in returning another duplicated row. how do i make a query to select only the required result without any duplicate row. is there any different type of MySQL Join i should be using?</p>
  
  <p>thank you</p>
  
  <p><strong>UPDATE :</strong></p>
  
  <p>here is the contacts table, the column area_id may have several duplicate values.</p>
  
  <p><img src="https://i.stack.imgur.com/HMgzu.png" alt="enter image description here"></p>
  
  <p><strong>ANSWER :</strong> </p>
  
  <p>there was an error in my condition in last LEFT JOIN where i have used <code>(s.country_id = c.id)</code>  instead it should be <code>(s.country_id = cn.id)</code> after splitting the query and testing individually i got to track the error. thank you for your response. it works perfectly fine now.</p>