Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MySQL,我怎样才能只选择超过一周的行?
我需要这样做来创建一个系统来删除我存储在数据库中的旧 tmp 文件。
试试这个,
select * from table where DATEDIFF(now(),colname) > 7;
select * from table where (SELECT DATEDIFF(curtime(),col_name)) > 7
SELECT * FROM `table` WHERE `created` < dateadd(week,-1,getdate())