Friday, 15 April 2011

mysql - How to UPDATE in one table in SQL based on matching data in another table? -


I got many questions with similar questions, but no one addressed me to a specific question.

How does updating with such conditions work between two unlinked tables?

As an example

  TABLE_I id, place, junk, junk, junk TABLE_II ID, category, placed, note, junk, junk ...  

If the status is in tabi_II

  where range = 9 and note = @ test rate  

should be an update, where One value in tab IV matches one in the table_i

  UPDATE TABLE_I SET placed = @ testvalue WHERE  

.. current TABLE_I.Placed = Table_II.Placed Assume that the above conditions are met

whether the SQA Is such a step-conditioning even possible in L? Or will it require coding outside of the query to test it in phases?

SQL

  update t1 SET Add t1.Placed = @ testvalue Table_1 T1 to Table 2 in 2 t2. Place = t2. Place where t2.Category = 9 and t2.Note = @ testvalue  

MySQL

The answer is yes you can

P> Try this to include such a

  table_1 on t1 t1 in table_2 T2. Place = t2.placed where t2.Category = 9 and t2.Note=@testvalue SET t1.Placed = @ testvalue   

Edit:

Inclusion in normal update To be:

  Add a updated tablet to a.join_colA = b.join_colb SET A.columnToUpdate = [some]  
on a join table b < / Html>

No comments:

Post a Comment