Reputation: 7041
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.
Upvotes: 0
Views: 96
Reputation: 2913
I think you don't need to have '' fields that are non - variables. Just try this ;
SELECT * FROM commands WHERE category = "helloworld"
Upvotes: 0
Reputation: 181077
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.
Upvotes: 0
Reputation: 36621
Try with
SELECT * FROM `commands` WHERE `category` = 'helloworld'
instead. Note the ' around helloworld instead of `
Upvotes: 4