今天在做一个左链接的时候遇到这个问题,网上很多网人说修改表的编码什么的也都试了,但是问题变化接二连三,问题记录如下:
select t.card_num,t.uid,tt.business,ttt.name,t.exchange_time,tt.worth from t_prize_card t left join t_prize tt on t.prizeid = tt.id left join t_user ttt on t.uid = ttt.uid
where t.uid != '0' and t.exchange_time != 0 order by t.exchange_time desc limit 10;
修改SQL:
select t.card_num,t.uid,tt.business,ttt.name,t.exchange_time,tt.worth from t_prize_card t left join t_prize tt on t.prizeid = tt.id left join t_user ttt on t.uid COLLATE utf8mb4_unicode_ci = ttt.uid
where t.uid != '0' and t.exchange_time != 0 order by t.exchange_time desc limit 10;
运行成功,在左链接的字段上添加
COLLATE utf8mb4_unicode_ci
解决问题。