How to populate a table's foreign keys from other tables
I've got the following tables, of which translation is empty and I'm trying to fill: translation { id translated language_id template_id } language { id langname langcode } template { id tplname source domain total } The source data to fill translation is a temporary table that I've populated from an external CSV file: tmp_table { id translated langname tplname source domain } What I'd like to do is to fill translation with the values from tmp_table . The translated field can be copied directly, but I'm not quite sure how to fetch the right language_id (tmp_table.langname could be used to