Skip to content

Instantly share code, notes, and snippets.

@ramigb

ramigb/gist:8217446

Created Jan 2, 2014
Embed
What would you like to do?
Reset voting counts
UPDATE `votes_items` c
INNER JOIN (
SELECT `vote_id`, COUNT(`vote_id`) as total
FROM `votes`
GROUP BY `vote_id`
) x ON c.id = x.vote_id
SET c.votes_counter = x.total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment