I do not understand why I get an error saying "Unknown column 'cyclist.ISO_id' in 'where clause'"
SELECT name, gender, height, weight FROM Cyclist LEFT JOIN Country ON Cyclist.ISO_id = Country.ISO_id WHERE cyclist.ISO_id = 'gbr%';
I do not understand why I get an error saying "Unknown column 'cyclist.ISO_id' in 'where clause'"
SELECT name, gender, height, weight FROM Cyclist LEFT JOIN Country ON Cyclist.ISO_id = Country.ISO_id WHERE cyclist.ISO_id = 'gbr%';
It looks like your table name is Cyclist
, not cyclist
- capital C
. In your WHERE
clause your're therefore referencing the column of a table which does not exist.
From the docs (with my emphasis):
Although database, table, and trigger names are not case sensitive on some platforms, you should not refer to one of these using different cases within the same statement. The following statement would not work because it refers to a table both as my_table and as MY_TABLE:
mysql> SELECT * FROM my_table WHERE MY_TABLE.col=1;
Column, index, stored routine, and event names are not case sensitive on any platform, nor are column aliases.
So use either cyclist
or Cyclist
but consistently.
This is mostly relevant with OS. Naming Conventions are case sensitive in Unix whereas not in windows OS. You can change the parameter value of lower_case_table_names system variable to 0/2 depending on OS. The detail explanation is available at http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html