简体   繁体   English

MySQL中的未知列错误(#1054)

[英]Unknown column error in MySQL (#1054)

This sql fails: 这个sql失败了:

select * from RRICallouts as r 
    JOIN LevelToCalloutsJT as lc on ( `r.__kp_RecID` = `lc._kf_RecID~Callout` ) 
    JOIN Levels as l ON ( `lc._kf_RecID~Level` = `l.__kp_RecID` ) 
  where `l.__kp_RecID` = 201006221644060009

#1054 - Unknown column 'l.__kp_RecID' in 'where clause

This works: 这有效:

select `__kp_RecID` from Levels as l ;

Using MySQL 5.0.77 on some linux variant 在某些linux变种上使用MySQL 5.0.77

The problem is in your backticks. 问题在于你的反叛。 You should use them as follows: 您应该按如下方式使用它们:

`r`.`__kp_RecID` 

... instead of: ... 代替:

`r.__kp_RecID`

Test case: 测试用例:

CREATE TABLE test (id int, value int);
INSERT INTO test VALUES (1, 100);

SELECT `t`.`id` FROM test AS t;
+------+
| id   |
+------+
|    1 |
+------+
1 row in set (0.00 sec)

SELECT `t.id` FROM test AS t;
ERROR 1054 (42S22): Unknown column 't.id' in 'field list'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM