197
找出与之前(昨天的)日期相比温度更高的所有日期的 id 。
返回结果 无顺序要求 。
表: Accounts
+-------------+------+ | 列名 | 类型 | +-------------+------+ | account_id | int | | income | int | +-------------+------+
select w1.id
from Weather w1, Weather w2
where w1.temperature > w2.temperature
and datediff(w1.recordDate,w2.recordDate)=1
datediff(date1,date2):date1与date2相隔的天数
该篇文章讨论了如何从Accounts表中筛选出前一天(即昨天)温度高于当天的所有账户ID,通过比较Weatherw1和Weatherw2表中的温度,并使用datediff函数计算日期差为1的记录。
2898

被折叠的 条评论
为什么被折叠?



