Verified Commit 7294697a authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into 312-dev-export-json-as-zip

parents 0b81a7c8 ea8965c4
Pipeline #5690 passed with stages
in 103 minutes and 26 seconds
WITH total AS (SELECT * from nodes n where n.typename = 30)
, sum AS (SELECT count(*) from total)
, sum AS (SELECT count(*) AS "TOTAL" from total)
, increase AS (SELECT count(*) from total as t WHERE t.date >= date_trunc('month', current_date - interval '3' month))
SELECT *,
(SELECT (100 * (SELECT * from increase) / (SELECT * from sum))) AS "LAST 3 MONTHS / TOTAL"
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
......
WITH total AS (SELECT * from nodes n where n.typename = 9)
, sum AS (SELECT count(*) from total)
, sum AS (SELECT count(*) AS "TOTAL" from total)
, increase AS (SELECT count(*) from total as t WHERE t.date >= date_trunc('month', current_date - interval '3' month))
SELECT *,
(SELECT (100 * (SELECT * from increase) / (SELECT * from sum))) AS "LAST 3 MONTHS / TOTAL"
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
WITH total AS (SELECT * from nodes n where n.typename = 90)
, sum AS (SELECT count(*) from total)
, sum AS (SELECT count(*) AS "TOTAL" from total)
, increase AS (SELECT count(*) from total as t WHERE t.date >= date_trunc('month', current_date - interval '3' month))
SELECT *,
(SELECT (100 * (SELECT * from increase) / (SELECT * from sum))) AS "LAST 3 MONTHS / TOTAL"
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
WITH total AS (SELECT * from nodes n where n.typename = 210)
, sum AS (SELECT count(*) from total)
, sum AS (SELECT count(*) AS "TOTAL" from total)
, increase AS (SELECT count(*) from total as t WHERE t.date >= date_trunc('month', current_date - interval '3' month))
SELECT *,
(SELECT (100 * (SELECT * from increase) / (SELECT * from sum))) AS "LAST 3 MONTHS / TOTAL"
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
......
WITH total AS (SELECT * from auth_user as A)
, sum AS (SELECT count(*) from total)
, sum AS (SELECT count(*) AS "TOTAL" from total)
, increase AS (SELECT count(*) from total as t WHERE t.date_joined >= date_trunc('month', current_date - interval '3' month))
SELECT *,
(SELECT (100 * (SELECT * from increase) / (SELECT * from sum))) AS "LAST 3 MONTHS / TOTAL"
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
......
select count(*), date_trunc('month', n.date) from nodes n where n.typename = 30 group by 2 ORDER BY 2;
select count(*), date_trunc('month', n.date) from nodes n where n.typename = 9 group by 2 ORDER BY 2;
select count(*), date_trunc('month', n.date) from nodes n where n.typename = 90 group by 2 ORDER BY 2;
select count(*), date_trunc('month', n.date) from nodes n where n.typename = 210 group by 2 ORDER BY 2;
select count(*), date_trunc('month', a.date_joined) from auth_user a group by 2;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment