Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incidencia - EDA - Error en consultas con funciones de agregación #220

Open
PaulaaSTIC opened this issue Oct 4, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working EDA Exclusivo de EDA

Comments

@PaulaaSTIC
Copy link
Collaborator

Descripción

Al intentar ejecutar una consulta SQL con funciones de agregación (como MIN, MAX, y AVG) aplicando un CAST al resultado de la agregación, la consulta no funciona correctamente. El problema ocurre cuando el CAST se aplica después de la función agregada, en lugar de aplicar el CAST a cada valor individual antes de la agregación. Esto causa que la primera consulta falle mientras que la segunda consulta funciona correctamente.

SELECT
	cast(min(`sda_contacts`.`stic_age_c`) as decimal(32, 0) ) as `Edat ((mínima)`,
	cast(max(`sda_contacts`.`stic_age_c`) as decimal(32, 0) ) as `Edat (màxima)`,
	cast(avg(`sda_contacts`.`stic_age_c`) as decimal(32, 2) ) as `Edat (mitjana)`
FROM
	sda_contacts

	
SELECT
	min(cast(`sda_contacts`.`stic_age_c` as decimal(32, 0) )) as `Edat ((mínima)`,
	max(cast(`sda_contacts`.`stic_age_c` as decimal(32, 0) )) as `Edat (màxima)`,
	avg(cast(`sda_contacts`.`stic_age_c` as decimal(32, 2)) ) as `Edat (mitjana)`
FROM
	sda_contacts

La consulta debe permitir el CAST correctamente aplicando la transformación a cada valor antes de la agregación para obtener resultados correctos.

@PaulaaSTIC PaulaaSTIC added bug Something isn't working EDA Exclusivo de EDA labels Oct 4, 2024
@jortilles
Copy link
Collaborator

SinergiaCRM ya ha convertido los datos a numéricos. Por lo que "no hay que hacer nada mas"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working EDA Exclusivo de EDA
Projects
None yet
Development

No branches or pull requests

2 participants