Home  >  Article  >  Database  >  sql 查询特殊不包括日期的数据

sql 查询特殊不包括日期的数据

WBOY
WBOYOriginal
2016-06-07 17:47:101517browse

sql 查询特殊不包括日期的数据

sql ="select * from test where dates not in (#2010-05-03#,#2010-05-12#)" '日期格式要前后加必须加#号

'这样就可以查出不包括#2010-05-03#,#2010-05-12#的所有数据了,再看一个比较笨的方法

'方法二

sql = "select * from test where datediff('d',日期,'2010-05-03')0" ;


'这个方法有一点麻烦,如果是N个日期那就要做N个datadiff哦。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn