UPDATE [user] set online=0 WHERE datediff(n,lastaction,getDate())>10 AND online=1