Why using a condition on Id not working?

  • 3
    SELECT a.Id FROM Weather a INNER JOIN Weather b ON a.Id=b.Id+1
     WHERE a.Temperature>b.Temperature

    I know the logic here is all about one day earlier, but the code I write should have given the same answer. However, it was not working here. Why?

  • 0

    because it is not a must tuples are arranged in date order, you can judge from the input of error case

  • 0

    Thanks for your reply. It's true that they are in date order, but it doesn't necessarily mean that they are not in id oder. Since they are also in id oder, why it is not working? Is it because we cannot directly plus 1 to the variable 'id'?

  • 0

    Check this test case:

    {"headers": {"Weather": ["Id"
    "rows": {"Weather": [[1

  • 0

    @czhfrank Have you figured out the reason?

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.