I have a database table which has two date columns (i.e. from_date
and to_date
). The from_date
column has data, but the to_date
is null
. I want to add dates in to_date
column to be exactly 7 days later than the from_date
.
Is this possible in Postgres?
The link provided for the duplicate of my post is so sophisticated and provides a solution for wide range of problems. I found my answer in Google. All I needed was a simple update:
UPDATE records
SET to_datetime=from-datetime;
UPDATE records
SET to_datetime = to_datetime + interval '7 day';