简体   繁体   中英

Illegal mix of collations for operation 'concat' from mysql

Illegal mix of collations for operation 'concat' from mysql.

select (select case when e._type='Call Log' then concat(d.firstname,' ',d.lastname,' ','Scheduled a Call On',' ',
e.logdate)
 when e._type='Meeting' then concat(d.firstname,' ',d.lastname,' ','Scheduled a Meeting  On', ' ',
 e.logdate) when e._type='Mail Log' then concat(d.firstname,' ',d.lastname,' ','Scheduled Mail On',' ',
 e.logdate) end  from schedulelog e where e.log_gid=a.log_gid) from log a
inner join employee b on a.log_by=b.user_gid
 inner join user d on a.log_by=d.user_gid;

This is my create table query

 `CREATE TABLE  `schedulelog` ( `log_gid` varchar(64) NOT NULL,  `bank_gid` varchar(64) default NULL,`logdate` date default NULL,      `_type` varchar(32) default NULL,`log_gid` varchar(64) default NULL,
  `status_flag` varchar(1) default NULL, `schedule_time` varchar(32) default NULL,`followup_type` varchar(64) default NULL,`product_gid` varchar(64) default NULL, `assign_to` varchar(64) default NULL,
  PRIMARY KEY  (`log_gid`), KEY `Index_2` (`bank_gid`),    
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=2730;`

Please use GROUP_CONCAT instead of concat

I think it will slove your problem

In your condition you try to use a string type (varchar/text) collection on noneString types (Date/Time/Int) fields and you get this error. What you have to do is see where you use these noneString fields in your condition and put them like this.

WHERE (CONVERT(`Here coms the name of the column` USING utf8)

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