Column Name | Type |
---|---|
id | int |
recordDate | date |
temperature | int |
id 是这个表的主键
该表包含特定日期的温度信息
+----+
| id |
+----+
| 2 |
| 4 |
+----+
2015-01-02 的温度比前一天高(10 -> 25)
2015-01-04 的温度比前一天高(30 -> 20)
select w1.id
from Weather w1 join Weather w2
on date_format(date_sub(w1.recordDate,interval 1 day),‘%Y-%m-%d‘) = date_format(w2.recordDate,‘%Y-%m-%d‘) and w1.temperature > w2.temperature ;
原文:https://www.cnblogs.com/endless-daydream/p/14018645.html