Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This queries the stats data that is used to populated the graphs on the initial staff dashboard page to find the number of active users over total users for each site group for a month. It is restricted to Unit type groups.

Code Block
languagesql
SELECT
  A.code,
  A.group_name,
  B.value,
  C.value
FROM
  pv_group A
LEFT JOIN pv_group_statistic B ON A.id = B.group_id AND B.type_id = 52 AND B.start_date = '2021-12-01'
LEFT JOIN pv_group_statistic C ON A.id = C.group_id AND C.type_id = 53 AND C.start_date = '2021-12-01'
WHERE
  A.type_id = 1;

...