我想更新我的表,并在每年的2010年时间戳上添加4年。我使用的是postgresql。
x | y
c | 2010-05-08 16:23:00
d | 2011-01-01 01:23:45
期望的结果:
x | y
c | 2014-05-08 16:23:00
d | 2011-01-01 01:23:45
谢谢。
答案 0 :(得分:3)
update the_table
set y = y + interval '4' year
where extract(year from y) = 2010;