Skip to content

Instantly share code, notes, and snippets.

@atopal
Last active August 29, 2015 14:10
Show Gist options
  • Save atopal/7fc680cd3815ffcb1d50 to your computer and use it in GitHub Desktop.
Save atopal/7fc680cd3815ffcb1d50 to your computer and use it in GitHub Desktop.
Get all comments for an article by document ID
SELECT `wiki_helpfulvotemetadata`.`vote_id`, `wiki_helpfulvotemetadata`.`value`
FROM `wiki_revision`
JOIN `wiki_document` ON `wiki_revision`.`document_id` = `wiki_document`.`id`
JOIN `wiki_helpfulvote` ON `wiki_revision`.`id`= `wiki_helpfulvote`.`revision_id`
JOIN `wiki_helpfulvotemetadata` ON `wiki_helpfulvote`.`id` = `wiki_helpfulvotemetadata`.`vote_id`
WHERE `wiki_document`.`id`= "735"
AND `wiki_helpfulvote`.`helpful` = "0"
AND `wiki_helpfulvotemetadata`.`key` = "survey"
AND `wiki_helpfulvotemetadata`.`value` NOT LIKE '%comment": ""%'
AND `wiki_helpfulvote`.`created` BETWEEN '2014-11-01 0' AND '2014-12-01 0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment