MySQL Replace is not working -
i try use mysql replace following table.
create table price ( id bigint unsigned auto_increment, ski_chalet_id bigint unsigned not null, month date not null, d_1 double(18, 2), d_2 double(18, 2), d_3 double(18, 2), d_4 double(18, 2), d_5 double(18, 2), created_at datetime not null, updated_at datetime not null, unique index fk_ski_chalet_price_ski_chalet_idx (ski_chalet_id, month), index ski_chalet_id_idx (ski_chalet_id), primary key(id) ) default character set utf8 engine = innodb;
i want add row if row not exist , update if row exist. used mysql replace that.
replace `price` set `ski_chalet_id` = 43 , `month` = '2013-04-01' , `d_1` = 23
this query successful. add value 00 , 0000-00-00 or null.
but insert query working.
insert `price` (`ski_chalet_id`,`month`,`d_1`) values ('34', '2013-04-01', '46');
i cant find whats issue. please me.
you have use "," instead on "and" in replace query ........
replace price
set ski_chalet_id
= 43 , month
= '2013-04-01' , d_1
= 23
note : replace function work want want don't have other functions.
Comments
Post a Comment