SELECT a.Pid,a.id FROM `user` as b,`reward` as a WHERE b.id=4 and a.Pid = b.Pid;
在执行上面语句是报错:Illegal mix of collations (ucs2_general_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘
解决方案:在等号的另一边加上CONVERT(b.Pid USING utf8) COLLATE utf8_unicode_ci;
具体sql如下:
SELECT a.Pid,a.id FROM `user` as b,`reward` as a WHERE b.id=4 and a.Pid = CONVERT(b.Pid USING utf8) COLLATE utf8_unicode_ci;