16

So I'm having trouble understanding on how to change the date on an update in postgres. What I have currently, that is giving a syntax error is

UPDATE works_locations SET (wrl_startdate = '2014-09-07', wrl_enddate = '2015-02-06') 

with a few statements determining which field I should specifically change. However, postgres is giving me an error. How do I successfully change the date in postgres, even if the start date is around two years prior to this entry?

1 Answer 1

26

I don't have Postgres installed so I can't test this but try removing the parenthesis on your SET clause so that it looks like this:

UPDATE works_locations SET wrl_startdate = '2014-09-07', wrl_enddate = '2015-02-06'
Sign up to request clarification or add additional context in comments.

3 Comments

Seems to have fixed it! Now I just got to go around and fix all my double quotes, thanks mate! EDIT: May I also ask as to why Postgres has this behaviour, if you know?
Your query did not follow the standard UPDATE query syntax. What database you were using where you had to put a parenthesis for the SET clause?
To be honest, I had no idea it was the correct syntax. The server I'm currently using is postgres! My mistake!

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.