I have a table (sessions) which has 2 columns that I have to use for this query. Session_Active (which is a tinyInt) and Last_active(which is a datetime).
I want to create a query that calculates the time difference between now and 'Last_active' for all tables WHERE 'Session_Active' is true, and if its greater than 5 minutes it should change 'Session_Active'.
This is the part that I have which works:
SELECT timediff(now(), `Last_Active`) from sessions WHERE `Session_Active` = true;
I have no clue at all how I can check if the difference is greater than 5 minutes, neither do I know where/how to put the UPDATE Session_Active = false
(If the difference is 5 minutes or more)
Thanks in advance! (: