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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -