开发者

MySQL INSERT IGNORE without TimeStamp

开发者 https://www.devze.com 2023-03-21 12:43 出处:网络
Good evening, I have one table, with a timestamp column, then I have a tool to insert into this table N registries. To avoid duplicate information in this 开发者_运维知识库table, I\'ve used INSERT IGN

Good evening, I have one table, with a timestamp column, then I have a tool to insert into this table N registries. To avoid duplicate information in this 开发者_运维知识库table, I've used INSERT IGNORE, but of course as you can imagine with the timestamp attribute always the new row is different. I cannot make a previous search and check the result set in my code, because I'm adding all the queries into a statement batch, that's why I'm using INSERT IGNORE. So the question would be, it is possible avoid the timestamp column when I'm making a compare between the new row and all the previous already inserted? the first time that used the tool?

Regards!.


Create a unique key on the fields you don't want duplicated, and exclude the timestamp field from that key.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号