asp操作access数据库里面时间的问题

2025-03-24 03:53:02
推荐回答(3个)
回答1:

1

select top 1 * from tablename where userid="&12345&" order by [time] desc"

select top 1 * from tablename where userid='"&12345&"' order by [time] desc"
哪个能用用哪个,因为不确定你userid的字段属性

2
select sum(num) from tablename where userid="&12345&" and month([time])=1"

回答2:

1.select * from 表名 where userID=12345 and time in(select max(time) form 表名 )
2.select sum(num) as total from 表名 where month(time)=1 and userID=12345

回答3:

select userid,num from 表名 where userid=12345 and time in(select max(time) from 表名 where userid=12345 )

select sum(num) as total from 表明 where month(time)=1 and userid=12345

用month()函数取自动获取时间里的月份