db2数据库 我要根据当前时间减去一个小时作为开始时间,当前时间作为结束时间查询总数量

select count(*) fromtable where req_time between (当前时间减去一个小时) and 当前时间;
当前时间怎么获得,还有(当前时间减去一个小时)这个这么写?

第1个回答  2011-05-18
select count(*) fromtable where req_time between current time - 1 hours and current time追问

我的时间类型是:timestamp
select count(*) from ii_mms_snd where req_time between current timestamp(这个地方怎么减一个小时) and current timestamp;

追答

select count(*) from ii_mms_snd where req_time between current timestamp - 1000*60*60 microseconds and current timestamp;

本回答被提问者采纳
相似回答