Jump to content

User:NaomiAmethyst/RfA Stats MySQL

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by NaomiAmethyst (talk | contribs) at 09:26, 23 June 2009 (++). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
SET
	@@group_concat_max_len = 8192
;
SELECT
	GROUP_CONCAT(
		`line`
		SEPARATOR
			'\n'
	)
	AS
		`wikitext`
FROM (
	SELECT
		CONCAT(
			'|-\n| ',
			`year`,
			'-',
			`month`,
			' || ',
			`size`
		)
		AS
			`line`
	FROM (
		SELECT
			YEAR(
				`rev_timestamp`
			)
			AS
				`year`,
			MONTH(
				`rev_timestamp`
			)
			AS
				`month`,
			SUM(
				`page_len`
			)
			AS
				`size`
		FROM (
			SELECT
				`mypage`.`page_len`,
				`rev_timestamp`
			FROM (
				SELECT
					`page_id`,
					`page_len`
				FROM
					`page`
				WHERE
					`page_namespace` = 4
					AND
					`page_title` LIKE 'Requests_for_adminship/%'
				)
				AS
					`mypage`
			JOIN
				`revision`
			ON (
				`mypage`.`page_id` = `rev_page`
			)
			GROUP BY `page_id`
		)
		AS
			`mytable`
		GROUP BY
			`year`,
			`month`
		ORDER BY
			`year`,
			`month`
			ASC
	)
	AS
		`myothertable`
)
AS
	`thelasttable`
;

1 row in set (8.59 sec)