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

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -