Home > Backend Development > PHP Tutorial > MYSQL如何在REPLACE INTO的时候加入一个判断

MYSQL如何在REPLACE INTO的时候加入一个判断

WBOY
Release: 2016-06-06 20:50:11
Original
1465 people have browsed it

我要频繁的用到REPLACE INTO。数据库字段有3个:

ID(索引字段),DATE,PLUS(附加字段)

我要插入的数据有两个字段

ID,DATE

我想加入一个条件,就是当ID+DATE字段都相同的时候,不REPLACE,因为这种情况下REPLACE会覆盖我的PLUS字段。能否只用一句话实现呢?

回复内容:

我要频繁的用到REPLACE INTO。数据库字段有3个:

ID(索引字段),DATE,PLUS(附加字段)

我要插入的数据有两个字段

ID,DATE

我想加入一个条件,就是当ID+DATE字段都相同的时候,不REPLACE,因为这种情况下REPLACE会覆盖我的PLUS字段。能否只用一句话实现呢?

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template