0

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%';
Ryan
  • 5
  • 2

3 Answers3

0

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.

udondan
  • 57,263
  • 20
  • 190
  • 175
  • Well, I guess that is the normal SO behavior. Other basically add the same answer but want theirs to be accepted. So they downvote you. ;) – udondan Mar 15 '15 at 03:34
0

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.

PM 77-1
  • 12,933
  • 21
  • 68
  • 111
0

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

Godson
  • 24
  • 2