title: Sqlite query by timestamp and value
body: <p>I have a <code>Sqlite</code> table with the following rows:</p>
  <ul>
  <li><code>id</code>: int PK autoincrement</li>
  <li><code>timestamp</code>: int value NOT NULL. Timestamp of the DB insertion</li>
  <li><code>value</code>: int value NOT NULL. Possible values [0-4].</li>
  </ul>
  <p>I want to query the database to obtain if all the values on the database for the registers contained within the 60 seconds before the given timestamp have the same <code>value</code>. For instance:</p>
  <pre><code>id | timestamp  | value
  1  | 1594575090 |   1
  2  | 1594575097 |   1
  3  | 1594575100 |   1
  4  | 1594575141 |   2
  5  | 1594575145 |   2
  6  | 1594575055 |   3
  7  | 1594575060 |   4
  </code></pre>
  <p>In this case, if I made the expected query for the registers contained on the 60 seconds before the register <code>3</code> (including the register <code>3</code>), it should query if the value of the registers <code>[1,2, 3]</code> are the same, which should <code>return 1</code>.</p>
  <p>On the other side, if this query was done with register <code>7</code>, it will compare <code>value</code> of registers <code>[4,5,6,7]</code> and it should <code>return 0</code>, as this value is not the same for the three of them.</p>
  <p>Any guesses of how can I perform this query?</p>