K
K
kuzubina2021-02-17 12:33:23
PostgreSQL
kuzubina, 2021-02-17 12:33:23

How to update timestamp field in PostgreSQL table?

In the table, each user has a lastLogin field, the timestamp data type, how to update this field each time the user logs in? I try like this -

'UPDATE users SET lastLogin = timestamp with time zone WHERE email = email is not updated

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava Rozhnev, 2021-02-17
@rozhnev

For example like this:

UPDATE users 
SET lastLogin = CURRENT_TIMESTAMP
WHERE email = '[email protected]'
;

PostgreSQL fiddle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question