Skip to content

Instantly share code, notes, and snippets.

@kjschiroo
Created June 10, 2016 22:03
Show Gist options
  • Save kjschiroo/86c40492884666aa799d63c51dbda4b2 to your computer and use it in GitHub Desktop.
Save kjschiroo/86c40492884666aa799d63c51dbda4b2 to your computer and use it in GitHub Desktop.
CREATE TABLE student_visual_edits
SELECT visual.date as date, visual.edits AS visual_edits, total.edits AS total_edits
FROM (
SELECT DATE(r.rev_timestamp) as date, Count(*) as edits
FROM enwiki_p.revision_userindex as r
JOIN students as s
ON r.rev_user_text = s.name
JOIN enwiki_p.change_tag as t
ON t.ct_rev_id = r.rev_id
WHERE t.ct_tag LIKE "visualeditor%"
GROUP BY DATE(r.rev_timestamp)
) AS visual
JOIN (
SELECT DATE(r.rev_timestamp) as date, Count(*) as edits
FROM students as s
JOIN enwiki_p.revision_userindex as r
ON r.rev_user_text = s.name
GROUP BY DATE(r.rev_timestamp)
) AS total
ON
total.date = visual.date;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment