title: How to retrieve data from three tables
body: <p>I have three table emp admin and login, emp and admin having auto increment each ,I want to retrieve emp_name and date_register from emp table and company_name from admin table and last_login_date from login table and in it there should be no duplicate value in it. I tried every thing cross join, inner join and outer join but did not get required data. Please help. What will be the right query for that? Below is my query which is giving duplicate value:</p>
  
  <pre><code>SELECT DISTINCT tb1_admin_detail.comp_name, tb1_employee_personalinfo.emp_fname, 
  tb1_employee_personalinfo.date_registered, tb1_employee_login_detail.login_date FROM 
  tb1_admin_detail, tb1_employee_personalinfo, tb1_employee_login_detail  WHERE 
  tb1_admin_detail.unit_id = tb1_employee_personalinfo.unit_id &amp;&amp; tb1_admin_detail.unit_id = tb1_employee_login_detail.unit_id &amp;&amp; 
  tb1_employee_personalinfo.Active =1 order BY tb1_employee_login_detail.unit_id ASC, 
  tb1_employee_login_detail.emp_id asc,  'tb1_employee_login_detail.login_date' desc ;
  </code></pre>