更新表中的日期,Postgresql
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26285422/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Update date within a table, Postgresql
提问by Phlex
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
所以我无法理解如何在 postgres 中更改更新日期。我目前所拥有的,这是一个语法错误
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?
用一些语句来确定我应该特别更改哪个字段。但是,postgres 给了我一个错误。即使开始日期在此条目之前大约两年,我如何成功更改 postgres 中的日期?
回答by gmarintes
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:
我没有安装 Postgres,所以我无法测试这个,但尝试删除 SET 子句上的括号,使其看起来像这样:
UPDATE works_locations SET wrl_startdate = '2014-09-07', wrl_enddate = '2015-02-06'