Reputation: 846
I have the following table
user
**id, name**, timestamp, place, time
the id with the name form the PK
I want to store the result of the following query in the time column which is already exist but contain no data
SELECT "time"(timestamp) FROM user as time
so if I had for example the following data
id: 1, name: Ann, timestamp: "2002-08-30 08:24:00", Place:US time:
and if if result of the following query
SELECT "time"(timestamp) FROM user
is 08:24:00
I would like to store that in the time column and I want to do that for all the users in the table
I tried the following
SELECT "time"(timestamp) FROM user as time
but it only displays the result as an output and I would like it to be stored
is there a way to do that ?
thanks
Upvotes: 0
Views: 75
Reputation: 434665
If you just want to set the "time"
of each row to the time-of-day of its "timestamp"
then:
update "user" set time = timestamp::time;
Upvotes: 2