sql - Update data from another table -


I need to update some data from another table.

I get data from the bus Want to call in Table 1 from Table 1 to Call 1 in Table 2, the rows are in one condition, so there is no need to actually make any ID-comparison ..

How can I do this?

  ---------------------------------------- - DB 1.Table1 (Take the model of the year to update Table 3 from this table) ---------------------------- ------------- imgid | Int | PK | Salamodel | Int | ----------------------------------------- --------- -------------------------------- DB2 Table 2 (Go through this table to update Table 3) - ----- ----------------------------------- IMGID | Int | PK | Uploaded ID | Int | FK (with table 3.uploadId). ---------------------------------------------------- ---------------------------------- Update this table with Db2.Table3 (Table 1 to Year Model ) ----------------------------------------- uploadId | Int | PK | Upload command will return Int | Sorry, my database diagram "cheese" has crashed for some strange reasons :( I hope you will live up to this idea  

I should also mention that Table 1 is located in another database .. which I'm not sure if that matters .. but well .. :)

Thanks in advance!

If you have a common key column in both tables & amp; This key column should have the same value (referring to the same lines in both tables) in both tables, then the query should work below:

  Updated Table 1 ST column 1 = T2 . Column 1 to Table 2 T2 Inner join table 1 T1 on T2. Column = T1. Column   

Edit:

  Update Table 3 Set UploadIir Model = T1. Model T1 INNER from Table Module Join Table 2 T2 On T.Imgid = T 1.Imgid Inner Job Table 3 T3OnT 3.UPloadId = T2.uploadId    < / Html>

Comments