LeetCode刷题实战197:上升的温度
Write an SQL query to find all dates' id with higher temperature compared to its previous dates (yesterday).
Return the result table in any order.
题意
解题
select w1.Id as Id
from Weather w1
#连接Weather表(自连接)
inner join Weather w2
#连接条件,w2是w1的前一天
on datediff(w1.RecordDate, w2.RecordDate) = 1
#筛选条件:温度升高
where w1.Temperature > w2.Temperature;
赞 (0)