Last active
December 17, 2015 14:39
-
-
Save solicomo/5626303 to your computer and use it in GitHub Desktop.
SQLite 删除一年前的数据
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQLite 没有 datediff() ,所以要删除一年前的数据需要如下语句: | |
1. 删除(从今天零点算起的) 365 天前的数据: | |
delete from tb_load_info where julianday(strftime('%Y-%m-%d',datetime('now','localtime'))) - julianday(strftime('%Y-%m-%d', created_at)) > 365; | |
2. 删除(从此时此刻算起的) 365 天前的数据: | |
delete from tb_load_info where julianday(datetime('now','localtime'))-julianday(created_at) > 365; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment