简体   繁体   中英

#1271 - Illegal mix of collations for operation 'UNION'

Trying to write a select-union query, but allways getting this error: #1271 - Illegal mix of collations for operation 'UNION'

Mysql query:

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'

When I separate it for 2 SELECTs - it works.

What I'm doing wrong? Thx.

You have columns in the two tables with different collations. Look at the COLLATE keyword in Books Online.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM