title: SQL problem: inner join gives me empty data set
body: <p>Please have a look at this question - <a href="https://leetcode.com/problems/rising-temperature/" rel="nofollow noreferrer">https://leetcode.com/problems/rising-temperature/</a></p>
  
  <p>I went with the approach of joining the table with itself and then putting my where condition to get the data I want. This is the query I wrote :-</p>
  
  <pre><code>SELECT wt1.Id FROM Weather wt1 
      inner join 
  Weather wt2 on wt1.id = wt2.id
  WHERE wt1.Temperature &gt; wt2.Temperature AND 
        TO_DAYS(wt1.recordDate)-TO_DAYS(wt2.recordDate)=1;
  </code></pre>
  
  <p>Which gives me an empty data set.</p>
  
  <p>However if I don't use join, and just use the Weather table twice, it works. My query :-</p>
  
  <pre><code>SELECT wt1.Id 
  FROM Weather wt1, Weather wt2
  WHERE wt1.Temperature &gt; wt2.Temperature AND 
        TO_DAYS(wt1.recordDate)-TO_DAYS(wt2.recordDate)=1;
  </code></pre>
  
  <p>I want to know what difference the inner join makes and why it doesn't work.</p>