From 7139a2976dc450e91d35fa73348e9ebfaa0e3e2e Mon Sep 17 00:00:00 2001 From: Alejandro Osornio <50227494+AOx0@users.noreply.github.com> Date: Wed, 15 Nov 2023 06:00:02 -0600 Subject: [PATCH] Ups --- src/bin/api.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/bin/api.rs b/src/bin/api.rs index 3660f4b..f35b031 100644 --- a/src/bin/api.rs +++ b/src/bin/api.rs @@ -1013,15 +1013,13 @@ async fn cantidad_alto_y_bajo( } = dbg!(sol); let mut resultados: Vec<(String, i64)> = sqlx::query_as(&format!( - "SELECT CONCAT(delito, ',', alcaldia_hecho), fre + "SELECT delito, fre FROM (SELECT id_delito, - id_alcaldia_hecho, COUNT(*) AS fre FROM delitos WHERE id_anio_hecho BETWEEN ? AND ? AND id_categoria = 1 GROUP BY id_delito) as R - JOIN alcaldia_hecho USING(id_alcaldia_hecho) JOIN delito USING(id_delito); ", )) @@ -1109,15 +1107,13 @@ async fn cantidad_alto_y_bajo2( } = dbg!(sol); let mut resultados: Vec<(String, i64)> = sqlx::query_as(&format!( - "SELECT CONCAT(delito, ',', alcaldia_hecho), fre + "SELECT delito, fre FROM (SELECT id_delito, - id_alcaldia_hecho, COUNT(*) AS fre FROM delitos WHERE id_anio_hecho BETWEEN ? AND ? AND id_categoria != 1 GROUP BY id_delito) as R - JOIN alcaldia_hecho USING(id_alcaldia_hecho) JOIN delito USING(id_delito); ", ))