title: Left Join based on field value
body: <p>I want to get all the detail about my purchase from the following tables,</p>
  
  <pre><code>1) tbl_track
  2) tbl_album
  3) tbl_purchase
  </code></pre>
  
  <p>tbl _purchase table :-</p>
  
  <pre><code>item_id
  type
  price
  </code></pre>
  
  <p>tbl_track table :-</p>
  
  <pre><code>id
  title
  description
  </code></pre>
  
  <p>tbl_album table :-</p>
  
  <pre><code>id
  title
  description
  </code></pre>
  
  <p>Now based on type of tbl_purchase I want to join one of table,
  It means If <code>type = 0</code> then <code>LEFT JOIN</code> with <code>tbl_track</code> and for <code>type = 1</code> then <code>LEFT JOIN</code> with <code>tbl_album</code>.</p>
  
  <p>I want to do these with one query only, It is easily done with two query.</p>
  
  <p>Thanks in advance.</p>