Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
Fork of
Teahouse experimental user survival (v3)
by
EpochFail
This query is marked as a draft
This query has been published
by
EpochFail
.
Toggle Highlighting
SQL
SELECT user_id, SUM(revisions_3_to_4_weeks) AS revisions_3_to_4_weeks, SUM(revisions_1_to_2_months) AS revisions_1_to_2_months, SUM(revisions_2_to_6_months) AS revisions_2_to_6_months FROM ( (SELECT user_id, SUM( rev_timestamp IS NOT NULL AND DATEDIFF(rev_timestamp, user_registration) BETWEEN 21 AND 28 ) AS revisions_3_to_4_weeks, SUM( rev_timestamp IS NOT NULL AND DATEDIFF(rev_timestamp, user_registration) BETWEEN 30 AND 60 ) AS revisions_1_to_2_months, SUM( rev_timestamp IS NOT NULL AND DATEDIFF(rev_timestamp, user_registration) BETWEEN 60 AND 180 ) AS revisions_2_to_6_months FROM u2041__thr_p.th2_experimental_user AS user INNER JOIN user USING (user_id) LEFT JOIN revision_userindex ON rev_user = user_id AND rev_timestamp >= DATE_FORMAT( DATE_ADD(user_registration, INTERVAL 21 DAY), "%Y%m%d%H%i%S" ) GROUP BY 1) UNION (SELECT user_id, SUM( ar_timestamp IS NOT NULL AND DATEDIFF(ar_timestamp, user_registration) BETWEEN 21 AND 28 ) AS revisions_3_to_4_weeks, SUM( ar_timestamp IS NOT NULL AND DATEDIFF(ar_timestamp, user_registration) BETWEEN 30 AND 60 ) AS revisions_1_to_2_months, SUM( ar_timestamp IS NOT NULL AND DATEDIFF(ar_timestamp, user_registration) BETWEEN 60 AND 180 ) AS revisions_2_to_6_months FROM u2041__thr_p.th2_experimental_user AS user INNER JOIN user USING (user_id) LEFT JOIN archive_userindex ON ar_user = user_id AND ar_timestamp >= DATE_FORMAT( DATE_ADD(user_registration, INTERVAL 21 DAY), "%Y%m%d%H%i%S" ) GROUP BY 1) ) AS foo GROUP BY user_id;
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...