mysql - Update value column B if value in Column A matches a value in a list of values -


in 'domains' table - column 'name'. column b domain name's 'owner'.

all domains have owners field set value 'non'.

i need loop through , update of domains have owner 'cjs'.

my query guess....

update 'domains' set 'domains.owner' 'cjs' if 'domains.name' matches 'one these names'.

is way can create list (array?) of names against can check 'column a' against?

thanks

you can use where clause in update query. test if column in list of values, use in (list of values).

update domains set owner = 'cjs' name in ('name1', 'name2', 'name3', ...) 

Comments

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -