This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Due to limitations of SQLite, we need to make a temp table for this: | |
CREATE TEMP TABLE duped_urls AS | |
SELECT url, SUM(visits) AS total, MAX(modified) AS latest, MAX(_id) AS winner | |
FROM history | |
GROUP BY url | |
HAVING count(url) > 1; | |
UPDATE history | |
SET visits = (SELECT total FROM duped_urls WHERE duped_urls.url=history.url), |