title: MySQL Query to retrieve data from two tables even no data found in second table
body: <p>I want to fetch a data from two tables even if the second table has no data. I need empty values for no data. </p>
  
  <p>For e.g. table 1 has the fields </p>
  
  <ul>
  <li>id</li>
  <li>name</li>
  <li>password</li>
  </ul>
  
  <p>table 2 has </p>
  
  <ul>
  <li>id(foreign key refer id from table 1)</li>
  <li>f1</li>
  <li>f2</li>
  <li>f3 </li>
  </ul>
  
  <p>Some time table 2 doesn't have the value for a particular user. For that I need the null values.</p>
  
  <p>Here I give sample input and expected output</p>
  
  <pre><code>table1
  id name password
  1  nam1  pass1
  2  nam2  pass2
  
  table 2
  id f1 f2 f3
  1   1  2  3
  
  sample output
  id name password f1 f2 f3
  1  nam1  pass1   1  2  3
  2  nam2  pass2   null null null
  </code></pre>
  
  <p>I need a query to fetch a data.</p>