Reputation: 17
Is there some way of on a certain table column add an value to the column but keeping the old value?
I have this:
id | dateB/dateE |
1 | 2018-07-05 |
2 | 2018-07-05 |
I want after an update
:
id | dateB/dateE |
1 | 2018-07-05/ 2018-07-06 |
2 | 2018-07-05/ 2018-07-06 |
Upvotes: 0
Views: 721
Reputation: 1271151
A better solution:
alter table t add column dateB date;
alter table t add column dateE date;
update t
set dateB = col2,
dateE = date '2018-07-06';
alter table t drop column col2;
That is, store values using the correct types.
Upvotes: 2
Reputation: 48875
How about:
update my_table set col2 = col2 || '/ 2018-07-06';
Upvotes: 1