sql - leave a column alone while replacing in mysql -
so suppose there's table:
id column1 column2 1 333 4444 where id primary key
and do
replace table (id, column2) values (1, 55) this cause column1 become null...is there way specify query such leave whatever existing value of column1 when replace matches existing entry?
use insert ... on duplicate key update:
insert table (id, column2) values (1, 55) on duplicate key update column2 = values(column2)
Comments
Post a Comment