I am using MySQL 8 and am trying to get the time difference between the current time and a field in my database table called "created_on
". If the difference is less than 180 seconds, I need the query to return the number of seconds. If the number of minutes is > 180 and < 60, then print the number of minutes.
The following query keeps displaying the 1064 error code:
select current_timestamp, created_on,
case
when timestampdiff(second, created_on, current_timestamp) <= 180 then " seconds ago"
when timestampdiff(minute, created_on, current_timestamp) > 3 AND < 60 then " minutes ago"
else ''
end
from whp;
Can anyone offer advice on how to correct this?