views:

41

answers:

1

This sql fails:

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

+3  A: 

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'
Daniel Vassallo
backticks was the problem. many thanks. the column names are truly messy, but the db name (provided by the host) is even better - 481986_G5ikr6eJy9wmxRm0
andyknas
I don't envy you that, either!
Brian Hooper