summaryrefslogtreecommitdiff
path: root/graphs/sql/maas/req01.sql
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:08:27 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:08:27 +0200
commitc9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c (patch)
tree3e4f42f93c7ae89a364e4d51fff6e5cec4e55fa9 /graphs/sql/maas/req01.sql
add: graphs et rushs
Diffstat (limited to 'graphs/sql/maas/req01.sql')
-rw-r--r--graphs/sql/maas/req01.sql15
1 files changed, 15 insertions, 0 deletions
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;