title: Put two equal conditions into one WHERE clause - SQL
body: <p>I am doing the SQL exercise and got a question about <code>WHERE</code> clause.</p>
  <pre><code> - Write an SQL query to find all numbers that appear at least three times consecutively. 
  
  *Logs table:*
  
  id   Num
   1    1
   2    1
   3    1
   4    2
   5    1
   6    2
   7    2
  </code></pre>
  <p>My sql query code is:</p>
  <pre><code>SELECT DISTINCT a.Num AS ConsecutiveNums FROM Logs AS a
  INNER JOIN Logs AS b ON  a.Id + 1 = b.Id
  INNER JOIN Logs AS c ON a.Id + 2 = c.Id
  WHERE a.Num = b.Num = c.Num;
  </code></pre>
  <p>When I write condition as <code>WHERE a.Num = b.Num = c.Num</code>, the result shows  <code>{&quot;headers&quot;: [&quot;ConsecutiveNums&quot;], &quot;values&quot;: [[1], [2]]}</code>, which is not correct. But when I separate the condition to <code>WHERE a.Num = b.Num AND b.Num = c.Num</code>, the result is <code>{&quot;headers&quot;: [&quot;ConsecutiveNums&quot;], &quot;values&quot;: [[1]]}</code>, which is correct.</p>
  <p>Could anyone please tell the principle of the WHERE clause regarding this situation?</p>