我尝试执行以下查询
SELECT Scania.GensetType, Scania.EngineType, Scania.Engine60Hz, Scania.Alternator, Scania.PriceEur
FROM Scania
LEFT JOIN NordhavnGenset
ON Scania.GensetType=NordhavnGenset.Alternator
LEFT JOIN Generator
ON Scania.Alternator=Generator.Alternator
LEFT JOIN Insulation
ON NordhavnGenset.Insulation=Insulation.Insulation
LEFT JOIN Klasse
ON NordhavnGenset.Class=Klasse.Class
LEFT JOIN AirInletFilter
ON NordhavnGenset.AirInletFilter=AirInletFilter.AirInletFilter
LEFT JOIN IP
ON NordhavnGenset.Ip=IP.IP
WHERE (NordhavnGenset.MaxKva='46') and (Generator.Alternator='ECP34-1LN/4') and (Insulation.Insulation='F (90ºC/45ºC)') and (Klasse.Klasse='KRS\r') and (AirInletFilter.AirInletFilter='No') and (IP.IP='IP23');
但似乎
Scania.Alternator=Generator.Alternator
分别具有文本UTF 16和文本UTF8的数据类型。结果,它无法执行。我需要知道应该用于进行此转换的语法
这是我在执行查询时收到的错误消息
#1267 - Illegal mix of collations (utf16_unicode_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='
答案 0 :(得分:0)
您可以使用CONVERT(.. USING ..)
函数将值从一种字符编码转换为另一种字符:
Scania.Alternator = CONVERT(Generator.Alternator USING ucs2)
或者您可以查看为什么列编码不同,并考虑使用utf8或ucs2进行所有操作...