title: how to fetch specific and unique data from database different tables in php
body: <p>i want to fetch data from database three tables all are linked together.
  I'm facing problem, i have tried many methods to it like <code>merge, unique and separate list</code>.
  following is the code.</p>
  
  <pre><code>&lt;?php
  $conn=new mysqli("localhost","root","","db");
  
  $rows=$conn-&gt;query("select Account,Amount, event_name,event_description from donations
                      LEFT JOIN accounts
                      ON accounts.ID_Account=donations.ID_Account
                      LEFT JOIN events
                      ON events.event_id=donations.event_id ");
  $rows1=$conn-&gt;query("SELECT Account from accounts");
  
  while((list($Account, $Amount, $event_name,$event_description)=$rows-&gt;fetch_row()) and (list($Account)=$rows1-&gt;fetch_row()))
  {   
  echo "&lt;tr&gt;&lt;td&gt; $Account&lt;/td&gt;&lt;td&gt; $Amount &lt;/td&gt;&lt;td&gt;$event_name&lt;/td&gt;&lt;td&gt;$event_description&lt;/td&gt;&lt;/tr&gt;";    
  }   
  ?&gt;
  </code></pre>
  
  <p>Now The problem is, it shows duplicate data from accounts and also I want it to be like if there is no donation <code>$Amount</code> for the account <code>$Account</code> it should not show donation in front of <code>Account</code>, but it is showing. is there any way i can make it working the way i want?
  Many Thanks.</p>