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, ingresa o regístrate para enviar un comentario.