首页 > 其他 > 详细

LeetCode - Rising Temperature

时间:2015-04-20 00:31:34      阅读:165      评论:0      收藏:0      [点我收藏+]

  Description:Given a Weather table, write a SQL query to find all dates‘ Ids with higher temperature compared to its previous (yesterday‘s) dates.

  选出比前一天温度高的Id

  使用自连接,to_days函数是返回从零年开始的总天数。

  (为何把=误写成<会Runtime Error啊 不应该是WrongAnser!)

  

# Write your MySQL query statement below
select w2.Id from Weather w1, Weather w2
where to_days(w1.Date)+1=to_days(w2.Date) and w1.Temperature<w2.Temperature;

 

LeetCode - Rising Temperature

原文:http://www.cnblogs.com/wxisme/p/4440332.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!