Update DB Table based on another temp Table data
-
I'm having a temp table in which I'm inserting data. In temp table data is ok and I want to update another table with temp table data. I'm new to SQL My Query is: update result_table set result_table.a = temp.a, result_table.b = temp.b from temp where temp.a= 1 I'm deleting the data in temp table and inserting data again in temp table and updating the result table. How can I do this? Please share your opinions. Thanks!
-
I'm having a temp table in which I'm inserting data. In temp table data is ok and I want to update another table with temp table data. I'm new to SQL My Query is: update result_table set result_table.a = temp.a, result_table.b = temp.b from temp where temp.a= 1 I'm deleting the data in temp table and inserting data again in temp table and updating the result table. How can I do this? Please share your opinions. Thanks!
You probaly want a JOIN in the FROM part -- JOIN the result_table to temp ON some key you haven't mentioned.
You'll never get very far if all you do is follow instructions.