Why is my Query not working?

  • 0

    I have an idea of making two aliases, one contains all 4 observation ("previous"), the other contain only the last three ("nextday"). Then compare the temperature column from these two aliases, and select the days in the second table on which the temperature is greater than the temperature from the corresponding row in the first table. Is my idea wrong or is my code wrong?

    SELECT Id, Temperature AS previous
    FROM Weather;
    SELECT Id, Temperature AS nextday
    FROM Weather limit 1, 3; 
    SELECT nextday.Id
    FROM nextday, previous
    Where nextday.Temperature>previous.Temperature

Log in to reply

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