据我了解,INSERT IGNORE 会插入一个新条目,如果它尚不存在,则忽略它。所以我一直在尝试这样做一段时间,但它似乎不起作用。这是我的尝试:
insert insert ignore into rss_feeds (md5sum) values ("1234");
Query OK, 1 row affected (0.00 sec)
mysql> insert ignore into rss_feeds (md5sum) values ("1234");
Query OK, 1 row affected (0.00 sec)
mysql> insert ignore into rss_feeds (md5sum) values ("1234");
Query OK, 1 row affected (0.00 sec)
mysql> insert ignore into rss_feeds (md5sum) values ("1234");
Query OK, 1 row affected (0.00 sec)
mysql> select * from rss_feeds where md5sum="1234";
+------+--------+----------+---------+----------+--------+--------+---------+
| link | source | headline | updated | inserted | md5sum | itemid | emailed |
+------+--------+----------+---------+----------+--------+--------+---------+
| NULL | NULL | NULL | NULL | NULL | 1234 | NULL | NULL |
| NULL | NULL | NULL | NULL | NULL | 1234 | NULL | NULL |
| NULL | NULL | NULL | NULL | NULL | 1234 | NULL | NULL |
| NULL | NULL | NULL | NULL | NULL | 1234 | NULL | NULL |
+------+--------+----------+---------+----------+--------+--------+---------+
4 rows in set (0.00 sec)