多个字段唯一性如何处理?
情景
传统做法
现在做法
insert into news(new_title, new_abstr, new_code)
values('你是好','我是谁',MD5(CONCAT('你是好','我是谁')))数据存在,就更新,不存在,就插入如何处理?
情景
传统做法
现在做法
insert into news(new_title, new_abstr, new_code, update_time, create_time)
values('你是好','我是谁',MD5(CONCAT('你是好','我是谁')))
on DUPLICATE key Update
update_time=now(), create_time=now()