I am trying to solve the "rising temperature" question. Here is my code. For some reason the "datediff" is not working on leetcodeserver. Why?
Question:
Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates.
Answer:
select w2.Id
from Weather as w1, Weather as w2
where (w1.Temperature<w2.Temperature) and (datediff(w1.RecordDate, w2.RecordDate) = 1);
Even this simple code, which is working on mysql workbench, is not working here:
SELECT DATEDIFF('2011-08-17','2000-01-01','2011-08-08'); -- 9 days