title: Use foreign keys not just for restraints
body: <p>I want to create a dynamic query that will know what table I am joining based on the foreign key. Is there a way to utilize a foreign key for that? I would like to create a statement that can look up where the foreign key points and use that to select the correct values. Something that would work like this:</p>
  
  <pre><code>"SELECT t.*, f.Name FROM $table t INNER JOIN {foreign table(will change based on the table selected and the foreign key it has)} f WHERE t.key = '$key'";
  </code></pre>