计算时间差
![](https://img.haomeiwen.com/i14941357/c23e926c466083a0.png)
DATEDIFF() 函数
DATEDIFF(datepart, startdate, enddate) (计算时间差)
datepart:year | quarter | month | week | day | hour | minute | second | milisecond
startdata: 开始时间
enddata: 结束时间
Getdata(): 获取当前的系统日期
Mysql:datediff(被减数, 减数)
SQL Serve:(时间单位, 减数, 被减数)
Solution1
SELECT W2.Id
FROM Weather AS W1, Weather AS W2
WHERE W2.Temperature > W1.Temperature AND DATEDIFF(W2.RecordDate,W1.RecordDate)=1
网友评论