grsy(好梦成真) 说得没错。
select * from v_部门内信息 where year(归档时间)="2002" and month(归档时间)="7"
或者将时间换成上一页面传过来的值。select * from v_部门内信息 where year(归档时间)="&request.form("year")&" and month(归档时间)="&request.form("month")&"
如果是用oracle。则要这样写
select * from v_部门内信息 where to_char(归档时间,'yyyy-mm')='"&request.form("year")&" and month(归档时间)="&request.form("month")&"'
如果月1,则要转换成01。有多中形式自己看着办咯
where yourdataFeild between year+'-'+month+'-'+"01" and year+'-'+(month+1)+'-'+"01"
...总之构造时间后再用SQL语句进行时间比较,在字段上的运算不能动用SQL的索引。。
上面的所以答案都是对的,但在大型资料库中速度会很慢!
where yourdataFeild between year+'-'+month+'-'+"01" and year+'-'+(month+1)+'-'+"01"
...总之构造时间后再用SQL语句进行时间比较,在字段上的运算不能动用SQL的索引。。
上面的所以答案都是对的,但在大型资料库中速度会很慢!