我想计算出一个人对一篇文章进行编辑/更改的百分比,因此我可以相应地发送捐款。
如何自动执行此操作? (最好是PHP)
答案 0 :(得分:1)
编辑历史记录存储在revision
表中。如果你有页面ID,你可以按页面获得用户编辑的百分比(只需用页面ID替换1):
SELECT
rev_user, rev_user_text,
count(*) as rev_user_count,
(SELECT count(*) FROM revision WHERE rev_page = 1) as rev_total_count,
100 * count(*)/(SELECT count(*) FROM revision WHERE rev_page = 1) as rev_percent
FROM revision
WHERE rev_page = 1
GROUP BY rev_user