php - SQL query update with two WHERE -


i's posible update table 2 where?

update table_name set column_name ='test'  code='605'; 

becouse sql syntax 2 not exist? how solve?

use and or or:

using and:

update table_name set column_name ='test'  code='605'   , col='someval' 

when use and, update table only if both conditions satisfied.

using or:

update table_name set column_name ='test'  code='605'   or col='someval' 

when use or, update table if one of conditions satisfied.

edit:

for joining table in update query:

update t1 set column_name='test' table_name t1 join      another_table t2 on t1.pk=t2.fk t1.code='605'    , t2.column_from_other_table='someval' 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -