Quantcast
Browsing latest articles
Browse All 6 View Live

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 Article


Answer 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 Article


Answer by Michael Leaney for Need to insert SQL without duplicates

ALTER TABLE `feed_items` ADD UNIQUE INDEX `constraint` (`link`, `remote_id`);

View Article

Answer 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 Article

Answer by alex for Need to insert SQL without duplicates

Add a UNIQUE constraint to those two columns.

View Article


Need 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
Browsing latest articles
Browse All 6 View Live