I am trying to select all rows that have "helloworld" in "category" column. Here is my query:
SELECT * FROM `commands` WHERE `category` = `helloworld`
I get this error:
Unknown column 'helloworld' in 'where clause'
I would appreciate any help.
3 Answers 3
Try with
SELECT * FROM `commands` WHERE `category` = 'helloworld'
instead. Note the ' around helloworld instead of `
answered Jan 22, 2012 at 19:56
Robin
36.7k5 gold badges51 silver badges103 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
I think you don't need to have '' fields that are non - variables. Just try this ;
SELECT * FROM commands WHERE category = "helloworld"
answered Jan 22, 2012 at 19:59
aacanakin
2,9134 gold badges27 silver badges43 bronze badges
Comments
That should be
SELECT * FROM `commands` WHERE `category` = 'helloworld'
Note the difference in quotes. Strings are quoted with ' while table/column names can optionally be quoted with ` to avoid being interpreted as keywords.
answered Jan 22, 2012 at 19:57
Joachim Isaksson
182k28 gold badges298 silver badges308 bronze badges
Comments
lang-sql