是这样的,首先你需要在表A中创建一个“时间”列,假设我们取名为“time”,然后我们将js传入的时间段命名为“timeStart”及“timeEnd”,然后sql语句就可以写出来啦:
select count() from A where time between timeStart and timeEnd
1、创建测试表,
create table test_date(id varchar2(20), v_date date);
2、插入测试数据
insert into test_date values(1, to_date('2010-9-23 10:10:10','yyyy-mm-dd hh24:mi:ss'));
insert into test_date values(2, to_date('2010-9-24 10:10:10','yyyy-mm-dd hh24:mi:ss'));
insert into test_date values(3, to_date('2010-9-25 10:10:10','yyyy-mm-dd hh24:mi:ss'));
insert into test_date values(4, to_date('2010-9-26 10:10:10','yyyy-mm-dd hh24:mi:ss'));
insert into test_date values(5, to_date('2010-9-27 10:10:10','yyyy-mm-dd hh24:mi:ss'));
commit;
3、查询表中全量数据,select t, rowid from test_date t;
4、编写sql,查询日期为2010-9-23的数据;
select t from test_date t where to_char(v_date,'yyyymmdd') = 20100923;
这个可以使用sum函数去实现 返回来的就是这段时间内所有数字的总和
select sum('个数') from '表名' where '时间' between '时间一' and '时间二';
以上就是关于求一个sql语句。查询出来每一天的产生数据的条数。全部的内容,包括:求一个sql语句。查询出来每一天的产生数据的条数。、sql语句如何查日期字段的某天的数据、php使用mysql数据库,要查询一个时间段里面每一天的数据量,当天没有则显示0.时间段可能是几天或者几月等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)