#1271 - 'UNION' 操作的排序规则的非法混合 [英] #1271 - Illegal mix of collations for operation 'UNION'
本文介绍了#1271 - 'UNION' 操作的排序规则的非法混合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试编写选择联合查询,但总是收到此错误:#1271 - 'UNION' 操作的排序规则的非法混合
Trying to write a select-union query, but allways getting this error: #1271 - Illegal mix of collations for operation 'UNION'
Mysql 查询:
SELECT users.*, offices.name as office_name FROM huilo_daikiri.`users` left outer join offices on (offices.id=users.office_id) where users.id='120'
union all
SELECT users.*, offices.name as office_name FROM huilo_laroc.`users` left outer join offices on (offices.id=users.office_id) where users.id='185'
当我将它分成 2 个 SELECT 时 - 它有效.
When I separate it for 2 SELECTs - it works.
我做错了什么?谢谢.
推荐答案
两个表中的列具有不同的排序规则.查看联机丛书中的 COLLATE 关键字.
You have columns in the two tables with different collations. Look at the COLLATE keyword in Books Online.
这篇关于#1271 - 'UNION' 操作的排序规则的非法混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文