MySQL INSERT IGNORE without TimeStamp
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.
精彩评论