Created
April 4, 2012 20:46
-
-
Save rnewman/2305471 to your computer and use it in GitHub Desktop.
Start of a query
This file contains hidden or 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
PSEUDOCODE! Need to join the subquery to get the values available for the update. | |
UPDATE history SET visits = total | |
modified = latest | |
deleted = (modified <> latest) | |
WHERE uri IN ( | |
SELECT uri, count(uri), SUM(visits) AS total, MAX(modified) AS latest | |
GROUP BY uri | |
HAVING count(uri) > 1 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment