今天遇到一个问题,需要查询当天的数据量,查了好多资料的sql都不能用。
最终自己发现个方法:
查询当前24小时内的数据:
select count(*) from 表名 where data_time between now()-1 and now();
查询当天的数据:
select * from 表名 where data_time >= to_char( sysdate ,'yyyy-mm-dd')
and date < to_char( sysdate+1 ,'yyyy-mm-dd')