I would like to do this in one step so I would like to know how can I:
table a (documents
) has: pk, document_id, template_id
table b (templates
) has: pk, template_id, template_table_name
table c (template_table_name_1
) has: pk, document_id, document_specific_columns
so... I would like to query table a, get document_id and template_id and then using table b i would like to get document_specific_columns from table c. PS: in table a can be more records with same document_id but different template_id I guess the intentions are pretty clear, the only thing I don't know how to do is to reference FROM clause of the subquery that returns te template_table_name1 to a table