title: querying a table to get the name of other table from a field to perform a final query
body: <p>Is there a way to accomplish this? A query that can get a table name from a field in another table and condense all columns of that table to one line of key:val; pair. (There will only be one determined from the assoc table ft_data_id)</p>
  
  <p>Fiddle: <a href="http://sqlfiddle.com/#!2/b0c27" rel="nofollow">http://sqlfiddle.com/#!2/b0c27</a></p>
  
  <pre><code>ID  FT_ID   FT_DATA_ID  NAME        TABLE                   DATA
  1   1       1           one         features_data_one       ro_one: A; ro_two: B
  2   2       1           two         features_data_two       rt_two: C; rt_two: D
  
  
  
  /****** list of features with the name and the table the data lies in */
  CREATE TABLE features (
          id INT AUTO_INCREMENT PRIMARY KEY,
          name VARCHAR(20) NOT NULL,
          `table` VARCHAR(255) NOT NULL
  );
  INSERT INTO features(name, `table`) VALUES ('one', 'features_data_one');
  INSERT INTO features(name, `table`) VALUES ('two', 'features_data_two');
  
  
  /****** feature one */
  CREATE TABLE features_data_one (
          id INT AUTO_INCREMENT PRIMARY KEY,
          ro_one VARCHAR(20) NOT NULL,
          ro_two VARCHAR(20) NOT NULL
  );
  INSERT INTO features_data_one (ro_one, ro_two) VALUES ('A', 'B');
  
  
  
  /****** feature two */
  CREATE TABLE features_data_two (
          id INT AUTO_INCREMENT PRIMARY KEY,
          rt_one VARCHAR(20) NOT NULL,
          rt_two VARCHAR(20) NOT NULL
  );
  INSERT INTO features_data_two (rt_one, rt_two) VALUES ('C', 'D');
  
  /****** association table which links a feature with a feature_id. The feature_id is the id in a specific table. This table is specificed in the feature table. */
  CREATE TABLE assoc (
          id INT AUTO_INCREMENT PRIMARY KEY,
          ft_id INT NOT NULL,
          ft_data_id INT NOT NULL
  );
  INSERT INTO assoc (ft_id, ft_data_id) VALUES (1, 1);
  INSERT INTO assoc (ft_id, ft_data_id) VALUES (2, 1);
  
  
  SELECT * 
  FROM assoc a
  INNER JOIN features as ft ON a.ft_id = ft.id;
  </code></pre>