如何实现数据库中数据纪录的对比呢
如何实现数据库中前后两个月相应数据纪录的对比呢?当然已经有对比条件,请帮忙呀,如何实现,最好有代码呀
2006-03-14 10:46
2006-03-14 13:11
2006-03-14 15:19
2006-03-14 15:19
2006-03-14 19:26
2006-03-15 14:03
2006-03-15 14:04
用SQL语句查询
select * From table where Datediff(day,table.date,'"&Now()&"')=-31
-31为当前时间的上个月的纪录
select * From table where Datediff(day,table.date,'"&Now()&"')=31
应该是这么写也有可能不对,没试过。
table为表名,table.date为日期字段,DateDiff为SQL函数作用是求得两个日期间相隔的时间。
2006-03-15 21:03
2006-03-16 09:47
2006-03-16 12:36