title: How to fetch two tables and sort the data by date?
body: <p>I need a query that fetches data fron two tables and sort them by date. </p>
  
  <p><strong>Table 1: Invoice</strong></p>
  
  <pre><code>&lt;?php
  $query = mysql_query("select * from invoice where customer = 95");
  ?&gt;
  ID     Customer     Amount     Date
  1      95           1500       01-Apr-2017
  2      95           5500       09-Apr-2017
  3      95           22000      10-Apr-2017
  4      95           35000      11-Apr-2017
  </code></pre>
  
  <p><strong>Table 2: Payments</strong></p>
  
  <pre><code>&lt;?php
  $query = mysql_query("select * from Payments where customer = 95");
  ?&gt;
  ID     Customer     Amount     Date
  1      95           10000      02-Apr-2017
  2      95           11000      09-Apr-2017
  3      95           22000      11-Apr-2017
  4      95           1200       15-Apr-2017
  </code></pre>
  
  <p>I need output as below:</p>
  
  <pre><code>ID     Date           InvoiceDR     InvoiceCR
  1      01-Apr-2017    1500          -
  2      02-Apr-2017     -            10000
  3      09-Apr-2017    5500          -
  4      09-Apr-2017     -            11000             
  </code></pre>