title: MySQL if/else for tables
body: <p>Is there a way to if else tables in mysql?</p>
  
  <p>Example:</p>
  
  <pre><code>select * from tableA A, if(tableA.find=1,TableBA B,TableBB B) where A.id = B.aid
  </code></pre>
  
  <p>Real Example:</p>
  
  <p>tables are: <code>location_order</code>, <code>order_contract</code>, <code>order_gm</code>, <code>order_gm_hh</code>:</p>
  
  <pre><code>select * 
  from   location order lo, order_contract oc, if(lo.hh=0,order_gm,order_gm_hh) as og 
  where  lo.orderid = oc.orderid &amp;&amp; oc.gmid = og.id
  </code></pre>