mySQL에서 있으면 수정하고 없으면 추가
create table machine(
machine_id int not null primary key
,
machine_name varchar(50)
,
reg_id int
);
INSERT INTO machine (reg_id, machine_id, machine_name) VALUES (1, 1, 'test_machine')
ON DUPLICATE KEY
UPDATE machine_name=VALUES(machine_name);
출처 http://stackoverflow.com/questions/5528854/usage-of-mysqls-if-exists
댓글 없음:
댓글 쓰기