Commit 82a333db authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] If no activity then null

parent 73429956
Pipeline #5685 passed with stages
in 98 minutes and 20 seconds
......@@ -2,7 +2,7 @@ WITH total AS (SELECT * from nodes n where n.typename = 30)
, 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 TO_CHAR((ROUND(100 * (SELECT * from increase) / (SELECT * from sum))), 'fm99%') AS "CREATED LAST 3 MONTHS")
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
......
......@@ -2,6 +2,6 @@ WITH total AS (SELECT * from nodes n where n.typename = 9)
, 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 TO_CHAR((ROUND(100 * (SELECT * from increase) / (SELECT * from sum))), 'fm99%') AS "CREATED LAST 3 MONTHS")
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
......@@ -2,6 +2,6 @@ WITH total AS (SELECT * from nodes n where n.typename = 90)
, 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 TO_CHAR((ROUND(100 * (SELECT * from increase) / (SELECT * from sum))), 'fm99%') AS "CREATED LAST 3 MONTHS")
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
......@@ -2,7 +2,7 @@ WITH total AS (SELECT * from nodes n where n.typename = 210)
, 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 TO_CHAR((ROUND(100 * (SELECT * from increase) / (SELECT * from sum))), 'fm99%') AS "CREATED LAST 3 MONTHS")
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
......
......@@ -2,7 +2,7 @@ WITH total AS (SELECT * from auth_user as A)
, 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 TO_CHAR((ROUND(100 * (SELECT * from increase) / (SELECT * from sum))), 'fm99%') AS "CREATED LAST 3 MONTHS")
(SELECT TO_CHAR((ROUND(100 * NULLIF((SELECT * from increase),0) / NULLIF((SELECT * from sum), 0))), 'fm99%') AS "CREATED LAST 3 MONTHS")
FROM sum
......
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