title: Join table depending on value of column in main table
body: <pre><code>notificationTable
  ID              type        typeID      userID
  ==============================================
  1               comment     34          2
  2               accept      22          2
  
  eventTable
  ID              event       content
  ===================================
  21              post        34  
  22              accept      22
  
  commentTable
  ID              comment     eventID
  ===================================
  34              'test'      21
  </code></pre>
  
  <p>I want to join different tables depending on the value of the column type.
  This is my current pseudocode:</p>
  
  <pre><code>SELECT *
  FROM notificationTable notification
  IF (notification.type == 'comment')
      LEFT JOIN commentTable comment
      ON notification.typeID = comment.ID
  ELSEIF (notification.type == 'accept')
      LEFT JOIN evenTable event
      ON notification.typeID = event.ID
  WHERE notification.userID = 2
  </code></pre>
  
  <p>Anyone knows the real query for my intention?</p>