mysqljava数据库
当前有张news表 有字段 addtime ,name ,
查询当前时间起,24小时前的数据,时间不知怎么写。
article where to_days(add_time) = to_days(now());article where to_days(now()) – to_days(add_time)
article where date_sub(curdate(), INTERVAL 7 DAY) add_time);article where date_sub(curdate(), INTERVAL 30 DAY) add_time);article where date_format(add_time, ‘%Y%m') = date_format(curdate() , ‘%Y%m');article where period_diff(date_format(now() , ‘%Y%m') , date_format(add_time, ‘%Y%m')) =1;select * from news where datediff(year,addtime,getdate())
或者select * from news where addtime> sysdate-1
不需要考虑这个addtime的日期类型吗?
思路是把sysdate-addtime>1,当然,前提是日期格式相同
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号