Pasar al contenido principal

Details for users whose custom user field value is above average field value - DPQL Reports - Deskpro Support

0

Details for users whose custom user field value is above average field value Report

This query generates a list of users who have a value for a custom field which is above the average of that value for all users.

SELECT people.name, people.emails.email, people.custom_data[#] 

FROM people 

WHERE people.custom_data[#] > (SELECT AVG(people.custom_data[#]) FROM people) 

Here we use a sub-query in the WHERE clause to find an average of the field.

We are then able to use our query to SELECT against that data we have found, so the query will output user details for users where this value is above Zero.

Nuevo comentario

Por favor, inicia sesión o regístrate para enviar un comentario.

¿Necesitas que te recordemos la contraseña?