From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001
From: Martial Simon <msimon_fr@hotmail.com>
Date: Mon, 15 Sep 2025 01:08:27 +0200
Subject: add: graphs et rushs

---
 graphs/sql/maas/req01.sql | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 graphs/sql/maas/req01.sql

(limited to 'graphs/sql/maas/req01.sql')

diff --git a/graphs/sql/maas/req01.sql b/graphs/sql/maas/req01.sql
new file mode 100644
index 0000000..d017c93
--- /dev/null
+++ b/graphs/sql/maas/req01.sql
@@ -0,0 +1,15 @@
+CREATE VIEW memorin.devices_summary AS
+    SELECT
+    total_devices,
+    active_devices,
+    total_devices - active_devices AS inactive_devices
+    FROM
+    (
+        SELECT COUNT(*) AS total_devices
+        FROM memorin.devices
+    ) AS d,
+    (
+        SELECT COUNT(*) AS active_devices
+        FROM memorin.devices
+        WHERE deactivated_at IS NULL
+    ) AS a;
-- 
cgit v1.2.3

