MYSQL要查询八月到十月的记录,该怎么写?

来源:百度知道 编辑:UC知道 时间:2024/07/06 12:00:50
里面的时间字段是整型,要查询八月到十月的语句该怎么写?

首先你的数据库要有一个日期的字段代表该条记录的操作的时间
然后这样写
sql="select * from XX where Month(dtThetime)<=10"
(注:dtThetime是你数据库里存放时间的字段名称)
sql=sql & " and Month(dtThetime)>=8"
解:Month是vbscript中用来提取月的函数返回一个1-12之间的整数

select * from biao where yue between 8 and 10