title: How to get lines that do not exceed 900 seconds for the last 24 hours by unixstamp
body: <p>How to get lines that do not exceed 900 seconds for the last 24 hours by unixstamp? Thanks</p>
  
  <pre><code>CREATE TABLE `users` (
    `id` int(10) UNSIGNED NOT NULL,                     // User ID
    `regdate` int(10) UNSIGNED NOT NULL DEFAULT '0',    // Registration date in UNIX timestamp 
    `lastactive` int(10) UNSIGNED NOT NULL DEFAULT '0', // Last active date in UNIX timestamp 
    `lastvisit` int(10) UNSIGNED NOT NULL DEFAULT '0',  // Last visit date in UNIX timestamp
    `lastpost` int(10) UNSIGNED NOT NULL DEFAULT '0'    // Last post date in UNIX timestamp 
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  
  INSERT INTO `users` (`id`, `regdate`, `lastactive`, `lastvisit`, `lastpost`) VALUES (13, 1569915390, 1583430726, 1583425902, 1583378778);
  
  /*
  * regdate = 1569915390 = Tuesday, October 1, 2019 7:36:30 AM
  * lastactive= 1583430726 = Thursday, March 5, 2020 5:52:06 PM
  * lastvisit = 1583425902 = Thursday, March 5, 2020 4:31:42 PM
  * lastpost = 1583378778 = Thursday, March 5, 2020 3:26:18 AM
  * 
  * 1. On connection and other activity, the lastactive is updated with time ()
  * 
  * 2. If the session cookie is older than 900 seconds then lastvisit is updated from lastactive
  * 
  * 3. When disconnected, lastvisit is updated from lastactive
  */
  </code></pre>
  
  <p>Here's my query now:</p>
  
  <pre><code>SELECT id
  FROM users
  WHERE lastvisit &gt; (NOW() - INTERVAL 24 HOUR) AND (NOW() - lastactive &lt; 900)
  </code></pre>
  
  <p><strong>EDIT:</strong>
  I think I found with the help of @tadman</p>
  
  <pre><code>SELECT *
  FROM users
  WHERE lastvisit &lt; (NOW() - INTERVAL 24 HOUR) AND lastactive &lt; (NOW() - INTERVAL 900 SECOND)
  </code></pre>