---
title: "sql常用"
author: "yangbinfx"
date: "2018-03-23T18:27:40Z"
tags: []
categories: ["移动开发"]
slug: "sql"
draft: false
lastmod: "2018-03-23T18:28:55Z"
id: 2414403
url: "https://yangbinfx.iteye.com/blog/2414403"
---

1.清理历史数据：

delete from 表\_biao  where created\_date &lt;= date\_format(date\_add(now(),interval-2 day),'%Y-%m-%d');

 

 

 

 

 

 

 

\------------------

/\*当前时间减1毫秒\*/  
SELECT DATE\_ADD(NOW(),INTERVAL -1 MICROSECOND);