I'm building a scheduled task in mySQL that will, every night, run through a table of users who are logged into the system and automatically logoff anyone who's been logged in for 2 weeks.
My current draft runs through the Login table, identifying the users logged in for over 2 weeks and puts their details into a temp table. I then loop through the temp table running the stored proc that does the log-off for each temp table entry.
Can anyone think of a simpler way of doing this? Especially one that doesn't involve using a loop?