I am trying to populate a table by inserting the values from a temp table as well as a single value from another table.
I have the SQL down to insert values from my temp table into my real table except for one column, and that column is a foreign key to another table. Let me give some example sql.
INSERT INTO location(value1,value2,value3,foreign_key_value)
SELECT tmpValue1
,tmpValue2
,tmpValue3
,(foreign_key_value from a different table needs to be here)
FROM tmp_location
If the foreign_key_value was found in my tmp table I could do a join, but that is not where I need to get the information from. I was wondering if there is anyway to reference the column value from my table where the foreign key points to in my Select statement. Or if there is a better way to do this.
If you need more information or clarification let me know!