mysqlphp索引
uid和book_id有联合unqiue索引,即一个人只能有一本书
需求: 更新11和14行,使uid=1005,若产生unique索引冲突(13和14行),则删除待更新的行(14行)
我能想到的办法是,先select待更新行并保存,同时删除(delete)这些行,再用insert IGNORE 插入。
这样太笨了,有没有操作mysql的方法,比如触发器什么的,或者更高效的,求教!!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn