56

I am trying to update the value of a column where it matches a certain userid, but it keeps giving a syntax error.

UPDATE user 
   SET balance = 15000.000000000 
 WHERE id = 11203;

The table called user has many rows with two columns, balance and id. I am trying to edit the balance of the user id in the code.

1
  • 1
    Post the create table statement. Commented Jul 2, 2012 at 20:15

2 Answers 2

80

Try "user", or give a more generic name:

UPDATE "user" 
 SET balance = 15000.000000000 
 WHERE id = 11203;

or ALTER your table name to "user_list" for example. Any doubt, please check keywords

Sign up to request clarification or add additional context in comments.

Comments

18

You need to escape user since it is a reserved word. Try

UPDATE "user"
SET balance = 15000.000000000 
WHERE id = 11203;

Comments

Your Answer

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.