0

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.

Robin
36.7k5 gold badges51 silver badges103 bronze badges
asked Jan 22, 2012 at 19:55

3 Answers 3

4

Try with

SELECT * FROM `commands` WHERE `category` = 'helloworld'

instead. Note the ' around helloworld instead of `

answered Jan 22, 2012 at 19:56
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

0

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

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.