I am having problems updating my table 'appointments' in postgreSQL. The table has a column date (type date) and a column time (type string). I need to join these two columns, and insert the value into a column starts_at (type timestamp) in the same table 'appointments'. I am having problems with finding the appropriate syntax to achieve that.
Any ideas?
Kind regards.
CodePudding user response:
If the time value is a properly formatted ISO time (e.g. '19:45:38'
), you can cast it to a time
value and add it to the date
value to get a timestamp
:
update appointments
set starts_at = the_date_column cast(the_time_column as time)