oracle中查询销售表中统计当天成交的笔数
create table t4(id int, je int ,time date);
www.2cto.com
insert into t4 values(3,10000,to_date('2012-11-25 15:12:00','yyyy-mm-dd hh24:mi:ss'));
select id ,je,to_char(time,'yyyy-mm-dd hh24:mi:ss') from t3;
SQL> select to_char(time,'yyyy-mm-dd hh24:mi:ss') from t3;
TO_CHAR(TIME,'YYYY-
-------------------
2012-12-25 12:12:12
2012-12-21 12:12:12
2011-12-21 15:00:00
2012-12-25 18:00:00
2012-12-25 18:12:00
2012-12-25 18:12:00
2012-11-25 15:12:00
select count(*) from t3 where substr( to_char(time,'yyyy-mm-dd hh24:mi:ss'),1,10)='2012-12-25';
SQL> select count(*) from t3 where substr(to_char(time,'yyyy-mm-dd hh24:mi:ss'),1,10)='2012-12-25';
COUNT(*)
----------
4