Created
April 6, 2012 13:55
-
-
Save danmactough/2319977 to your computer and use it in GitHub Desktop.
Run daily to remove read posts older than 14 days
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
DELETE `posts`,`postmeta` FROM `posts` LEFT JOIN `postmeta` USING (`post_id`) | |
WHERE `postmeta_read` IS NULL OR | |
(`postmeta_read`=b'10' | |
AND `postmeta_liked`<1 | |
AND `postmeta_starred`<1 | |
AND `postmeta_shared`<1 | |
AND DATEDIFF(CURDATE(),FROM_UNIXTIME(`posts`.`post_pubdate`)) > 14); | |
OPTIMIZE TABLE `posts`,`postmeta`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment