Answer by viperfx for Need to insert SQL without duplicates
Thanks for the replies!I actually managed to solve it a few hours after posting this, I made the remote_id a unique column and then did the following for the SQLINSERT INTO feed_items(feed_id,...
View ArticleAnswer by Jake Feasel for Need to insert SQL without duplicates
Try this:$this->db->query('INSERT INTO feed_items(feed_id, remote_id, link, title, created_time, updated_time) SELECT ?, ?, ?, ?, ?, NOW() WHERE not exists(SELECT 1 FROM feed_items f2 WHERE...
View ArticleAnswer by Michael Leaney for Need to insert SQL without duplicates
ALTER TABLE `feed_items` ADD UNIQUE INDEX `constraint` (`link`, `remote_id`);
View ArticleAnswer by Sudhir Bastakoti for Need to insert SQL without duplicates
You can use ON DUPLICATE for avoiding such conditions: Check: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.htmlHope it helps
View ArticleAnswer by alex for Need to insert SQL without duplicates
Add a UNIQUE constraint to those two columns.
View ArticleNeed to insert SQL without duplicates
The table is currently this:CREATE TABLE `feed_items` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `feed_id` int(11) NOT NULL, `remote_id` varchar(32) NOT NULL DEFAULT '', `title` varchar(255) NOT...
View Article