mysql数据库字符集不统一查询报错

Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=

其实是表和表之间的字符编码不匹配造成的,要么修改表字段的字符编码,要么就加函数

SELECT a.id, a.step, a.title, a.content, c.path stepImage FROM carRelaxedStep a 
LEFT JOIN city b ON CONVERT(b.code_c USING utf8) COLLATE utf8_unicode_ci = a.cityCodeC
LEFT JOIN FileInfo c ON c.id = a.stepImage
WHERE a.cityCodeC = #{cityCodeC} AND a.isDel =1 ORDER BY step ASC

猜你喜欢

转载自blog.csdn.net/wang20y8/article/details/81477871