[LeetCode] 197、上升的温度

题目描述
给定一个 Weather 表,编写一个 SQL 查询,来查找与之前(昨天的)日期相比温度更高的所有日期的 Id。

解题思路

图解SQL面试题:如何比较日期数据?

select a.Id
from weather as a cross join weather as b 
on datediff(a.RecordDate, b.RecordDate) = 1
where a.Temperature > b.Temperature;
发布了390 篇原创文章 · 获赞 576 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/ft_sunshine/article/details/103808795