I am getting an unknown column in field list error in a MySQL database select query, even though the column is actually there. I even checked the spelling by right clicking on the MySQL command line client and using the Find... tool to search for the correct spelling, which turned up matches both in the column list resulting from describe table and in the column name in the select query. How can I fix this?
Here is a screen capture of the MySQL command line client showing the error repeating even though I tested both the correct spelling UMLSCUI and an incorrect spelling UMLSCU1:
Here is a screen shot of the definition of the table:
Answer
you have to check the name of column atn
if it contains spaces in your database.
if there is space before or after that column name than it will be unknown column.
EDIT:
how check spaces ?
Put your cursor in the column name to edit and move cursor to right and see if there is spaces or it stops at the end of column same thing to the left.
EDIT2:
you should do it like that
select * from rxnsat
where ATN = 'RXN_STRENGTH' or ATN = 'UMLSCUI'; --//as UMLSCUI is a value in atn column
No comments:
Post a Comment