2020-04-13-(2)

计算时间差

Screen Shot 2020-04-13 at 3.57.21 PM.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

你可能感兴趣的:(2020-04-13-(2))