每日一题-8(上升的温度) 其他 2021-11-22 18:04 0 阅读 题8: 根据下面的表,编写一个SQL来查找与之前(昨天的)日期相比温度更高的所有日期的id. 解题思路:这是需要比较日期的,引入DATEDIFF()函数来比较两个日期类型的值,然后利用自连接,代码如下: select a.id from Weather as a inner join Weather as b on datediff(a.recordDate,b.recordDate) = 1 where a.Temperature>b.Temperature ; 猜你喜欢