Illegal mix of collations error in MySql

后端 未结 19 2284
醉梦人生
醉梦人生 2020-11-29 01:11

Just got this answer from a previous question and it works a treat!

SELECT username, (SUM(rating)/COUNT(*)) as TheAverage, Count(*) as TheCount 
FROM ratings         


        
19条回答
  •  情话喂你
    2020-11-29 01:52

    SELECT  username, AVG(rating) as TheAverage, COUNT(*) as TheCount
    FROM    ratings
            WHERE month='Aug'
            AND username COLLATE latin1_general_ci IN
            (
            SELECT  username
            FROM    users
            WHERE   gender = 1
            )
    GROUP BY
            username
    HAVING
            TheCount > 4
    ORDER BY
            TheAverage DESC, TheCount DESC;
    

提交回复
热议问题