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/outsourcing/req02.sql | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 graphs/sql/outsourcing/req02.sql

(limited to 'graphs/sql/outsourcing/req02.sql')

diff --git a/graphs/sql/outsourcing/req02.sql b/graphs/sql/outsourcing/req02.sql
new file mode 100644
index 0000000..1c2dd3d
--- /dev/null
+++ b/graphs/sql/outsourcing/req02.sql
@@ -0,0 +1,6 @@
+SELECT person_id,first_name,last_name,birth_date,O.created_at::date AS conviction_date,serving_time,(date '2059-12-03' <= T.created_at::date - concat(serving_time, ' month')::interval) AS could_be_released
+INTO public.outcome_status
+FROM justice.defendants AS D, public.people AS P, justice.trials as T, justice.outcomes AS O, justice.cases AS C
+WHERE D.person_id = P.id AND D.trial_id = T.id AND T.id = O.trial_id AND T.case_id = C.id
+AND O.outcome = 'GUILTY'
+AND C.classification = 'CRIME'
-- 
cgit v1.2.3

