我一直在网上搜索,甚至在有关此问题的 Stackoverflow 问题中搜索,但无法收到任何相关回复。我在下面显示的 SQL 查询,
SELECT Scania.GensetType
, Scania.EngineType
, Scania.Engine60Hz
, Scania.Alternator
, Scania.PriceEur
FROM Scania
LEFT JOIN NordhavnGenset
ON Scania.GensetType=NordhavnGenset.Alternator
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');
总是返回下面的错误信息,并且我已经检查了几次,该列存在于表中!
#1054 - Unknown column 'Generator.Alternator' in 'where clause'
但是,如果我通过在第一个 Where 子句处停止来执行查询,则会显示结果,
SELECT Scania.GensetType
, Scania.EngineType
, Scania.Engine60Hz
, Scania.Alternator
, Scania.PriceEur
FROM Scania
LEFT JOIN NordhavnGenset
ON Scania.GensetType=NordhavnGenset.Alternator
WHERE (NordhavnGenset.MaxKva='46');
新的查询
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');