Acabo de recibir esta respuesta de una pregunta anterior y funciona de maravilla.Mezcla ilegal de error de intercalaciones en MySql
SELECT username, (SUM(rating)/COUNT(*)) as TheAverage, Count(*) as TheCount
FROM ratings WHERE month='Aug' GROUP BY username HAVING TheCount > 4
ORDER BY TheAverage DESC, TheCount DESC
Pero cuando me pego este bit adicional en que da este error:
Documentation #1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin1_general_ci,IMPLICIT) for operation '='
SELECT username, (SUM(rating)/COUNT(*)) as TheAverage, Count(*) as TheCount FROM
ratings WHERE month='Aug'
**AND username IN (SELECT username FROM users WHERE gender =1)**
GROUP BY username HAVING TheCount > 4 ORDER BY TheAverage DESC, TheCount DESC
La tabla es:
id, username, rating, month
por cierto, ¿su columna users.gender es de tipo int? – stereoscott
Intenté eso: SELECCIONAR ratings.username, (SUM (ratings.rating)/COUNT (*)) como TheAverage, Count (*) como TheCount FROM ratings, usuarios WHERE ratings.month = 'Aug' y ratings.username = users.username AND users.gender = 1 GROUP BY ratings.username HAVING TheCount> 4 ORDER BY TheAverage DESC, TheCount DESC ¿Tiene el mismo error que antes? Sí, Gender is an int. – Oliver