title: How to join three tables from a database using just one common field amongst them all.(Mysql)
body: <p>These are three tables </p>
  
  <pre><code>1. table `p_transactions` has following fields
  
  (`txn_id`, `txn_uid`, `txn_bid_no`, `txn_date`, `txn_desc`, `txn_amt`, `txn_fee`, `txn_mode`, `txn_status`, `txn_mdate`)
  
  2 . table `p_game_results` has following fields.
  
  (`id`, `game_id`, `game_combo`, `game_combo_hr`, `cdate`, `mdate`)
  
  3. Table `p_game_room_results` has following fields
  
   (`id`, `game_id`, `room_id`, `txn`, `round`, `result`, `score`, `cdate`, `mdate`)
  </code></pre>
  
  <p>I would like to join them using their txn id as a common field.</p>
  
  <p>here's something I tried. but not sure, I'm sure its wrong .</p>
  
  <pre><code>$sql    = "SELECT * FROM " . $prefix . "_user_game_results".$prefix."_game_room_results".$prefix."_transactions WHERE". $prefix . "_user_game_result.uid"='$prefix."_game_room_results.id"'. and .$prefix."_transactions.txn_uid"='$prefix."_game_room_results.uid"'"";
          $result = $this-&gt;sql_fetchrowset($this-&gt;sql_query($sql));
  </code></pre>
  
  <p>Thanks.</p>