首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

高分求购SQL语句(ASP+access)!该如何处理

2012-04-20 
高分求购SQL语句(ASP+access)!table中有字段count(整数),time(日期/时间),days(整数)要求:如果当前时间减

高分求购SQL语句(ASP+access)!
table   中有字段count(整数),time(日期/时间),days(整数)
要求:
        如果当前时间减去time中的时间   >   days中的天数,
则更新这条记录的count为count+1,请写出完整的update语句。

[解决办法]
试试这句:

update 表名 set count=count+1 where DateDiff( "d ",time,Date()) > days
[解决办法]
update 表名 set count=count+1 where DateDiff( "d ",time,now()) > days

[解决办法]
update 表名 set [count]=[count]+1 where DateDiff( "d ",[time],now()) > days


[解决办法]
楼上的几位写法可行,不过效率高点可以这样写

declare @ValidTime datetime
set @ValidTime=dateadd(day,-days, getdate())
update 表名 set count=count+1 where [time] <@ValidTime
[解决办法]
update 表名 set count=count+1 where DateDiff( "d ",time,now()) > days
[解决办法]
晕~自己换算一下都不行呀~
update 表名 set [count]=[count]+1 where DateDiff( "s ",[time],now()) > (days * 86400)
[解决办法]
update 表名 set [count]=[count]+1 where DateDiff( "d ",[time],now()) > days
应该就可以了!~
[解决办法]
update 表名 set [count]=[count]+1 where DateDiff( "s ",[time],now()) > (days * 86400)
就这样写就可以了

热点排行