Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update date within a table, Postgresql

Tags:

sql

postgresql

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?

like image 777
Phlex Avatar asked Oct 09 '14 18:10

Phlex


People also ask

How do I format the current date in PostgreSQL?

The date format for the date data type in PostgreSQL is yyyy-mm-dd . This is the format used for both storing data and for inserting data.


1 Answers

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'
like image 116
gmarintes Avatar answered Oct 23 '22 20:10

gmarintes