Illegal mix of collations for operation 'concat'

后端 未结 5 1846
再見小時候
再見小時候 2020-12-09 11:18

I\'m trying to execute this concat query in mysql

SELECT CONCAT(if(fName,fName,\'\'),Name) 
From Student

Error:

#127

5条回答
  •  温柔的废话
    2020-12-09 11:37

    This is due to collections difference, you can solve by converting the two strings or columns to one collection say UTF8

    CONCAT(CAST(fName AS CHAR CHARACTER SET utf8),CAST('' AS CHAR CHARACTER SET utf8))
    

    This will solve :)

    you can check more about casting in MySQL here MySQL Casting

提交回复
热议问题