title: IF ELSE statement to join table sql
body: <p>I have one supertype table where I have to pick 1 subtype table from 2 subtypes a,b. A subtype cannot go with the other one so for me to query I have to check whether if the supertype id is contained on one of the subtypes. I have been doing experiment queries but cannot get it right.</p>
  
  <p>This is what somehow I thought of:</p>
  
  <pre><code>SELECT * from supertypetable INNER JOIN 
  IF  (a.id = given.id) then a ON a.id = supertypetable.id
  ELSE  b ON b.id = supertetable.id
  
  job Table
  ________________________________
  |job_id| blach2x....
  ________________________________
  |    1  |
  |    2  |
  |    3  |
  ________________________________
  
  partime Table
  ________________________________
  |job_id| blach2x....
  ________________________________
  |    2  |
  |    3  |
  ________________________________
  
  fulltime Table
  ________________________________
  |job_id| blach2x....
  ________________________________
  |    1  |
  |       |
  ________________________________
  </code></pre>
  
  <p>I want to join tables that satisfy my given id</p>