midnightsyntax
midnightsyntax

Reputation: 419

MySQL server doesn't put update value inside ' and ' so it think the value is a column

I just installed MySQL 5 on my server and imported a database from another server. Now when I tried to make a simple INSERT command with MySQL Workbench I got this from my server:

ERROR 1054: Unknown column 'Test1' in 'field list'
SQL Statement:
UPDATE `myTable`.`helpanswer` SET `Answer`=Test1 WHERE `id`='6'

When I, from a previous EDIT command, right clicked on the field "Answer" in a row, changed it, and pressed the "Apply all changes to data" button.

When I do this on the orginal server everything works fine.

Are there some setting I must change on my server to get this to work?

I dont get it why my server doesn't put "Test1" inside 'Test1' like it should...

I know I can use the UPDATE command but to be able to just right click the field and click a button saves me alot of time.

Upvotes: 0

Views: 234

Answers (2)

Marco
Marco

Reputation: 57583

Correct query should be:

UPDATE `myTable`.`helpanswer` 
    SET `Answer` = 'Test1' WHERE `id`='6'

This is because Test1 is a string and must be enclosed in quotes.

Upvotes: 1

Michael
Michael

Reputation: 309

MySQL is picky about quotes. Try this:

UPDATE `myTable`.`helpanswer` SET `Answer`='Test1' WHERE `id`='6'

Upvotes: 0

Related Questions