Skip to main content
edited tags
Link
Barbaros Özhan
  • 65.9k
  • 11
  • 36
  • 64
Source Link
user14937341
user14937341

How to check if a column value is updated/modified

I want to check if the logout_date column is updated. If it was updated then I have to modify the salary column.

login_time logout_time salary
2021-08-24 11:12:30 2021-08-24 14:34:56 1234

I have to check if the logout_time is updated, if it was updated then the salary would be 4567.

login_time logout_time salary
2021-08-24 11:12:30 2021-08-24 19:30:00 4567

If the logout_time is not updated, then the salary would be same i.e., 1234

login_time logout_time salary
2021-08-24 11:12:30 2021-08-24 14:34:56 1234

I have written below query, but i am not getting the required output.

select salary ,case when "logout_time" is updated then salary = new_salary from abc; 

Can someone help me with the query Can someone please help me with the query.