https://leetcode.com/problems/rising-temperature/description/
题目需要选出今天比昨天气温高的ID
用join,默认是inner join需要左右两边同时有才行。然后就是用on判断,首先判断其是相邻的两天。
用sql的DateDiff函数判断。
不知道为何用的和网上的结论相反
DateDiff(b, a) = 1表示b是a的下一天,才能ac
# Write your MySQL query statement below
select b.Id as Id
from Weather join (Weather as b) on DATEDIFF(b.Date, weather.Date) = 1 and b.Temperature >
标签:join,Temperature,DateDiff,197,Weather,Rising,sql,Date From: https://blog.51cto.com/u_15833059/5779614