Why using " dayofyear" doesnt work but " to_days " is fine ?


  • 0
    Z

    SELECT t1.Id FROM Weather AS t1, Weather AS t2 WHERE t1.Temperature>t2.Temperature AND DAYOFYEAR(t1.Date)-DAYOFYEAR(t2.Date)=1

    The code above gives me error

    But this one below works fine.

    SELECT t1.Id FROM Weather as t1, Weather as t2 WHERE t1.Temperature>t2.Temperature AND TO_DAYS (t1.Date)-TO_DAYS(t2.Date)=1


Log in to reply
 

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