?LeetCode刷題實戰(zhàn)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;
評論
圖片
表情
