DATEDIFF

    科技2025-01-05  14

    SELECT DATEDIFF('2017-11-30', '2017-11-29') AS COL1, -- 1 DATEDIFF('2017-11-30', '2017-12-15') AS col2; -- -15

    https://leetcode-cn.com/problems/rising-temperature/ 

    -- DATEDIFF(a.RecordDate, b.RecordDate)=1,表示a是今天b是昨天 SELECT a.id AS 'Id' FROM Weather a JOIN Weather b ON DATEDIFF(a.RecordDate, b.RecordDate) = 1 AND a.Temperature > b.Temperature;

    http://c.biancheng.net/mysql/datediff.html

    Processed: 0.011, SQL: 8