Inserting based on the results of a select query Initially I had all columns under 1 table. In table shown below had one additional column for all media items.


  did | disclaimer_title | disclaimer_body | disclaimer_media_items


But for some reasons, I need to pull out the disclaimer_media_items column into separate schema. So now I have 2 tables.

Table 1 schema


  did | disclaimer_title | disclaimer_body


Table 2 structure:


  did_media | disclaimer_media_items


Now what I want is when I insert media in table 2, the results get stored for table 1.

i.e. I want to achieve same functionality of all columns under table 1 with two individual tables. 

I know 2 things can work, either foreign key or Drupal joins. How can I achieve this?

Hope I explained it well.
db_merge is the solution for this.