select sum(IngestTimeLength)Year,
       sum(IngestTimeLength)Month,
       sum(IngestTimeLength)Date
from   talename
where  group by to_char(IngestTime,'YYYY'),
       group by to_char(IngestTime,'YYYYMM'), 
       group by to_char(IngestTime,'YYYYMMDD')

解决方案 »

  1.   

    需要说明一下,IngestTime字段为 VARCHAR2 类型的
      

  2.   

    to: lg_919(lg) 
    能帮我嘛?不行我再加200分送你,决不食言!!!
    拜托啦!!!
      

  3.   

    select substr(IngestTime,1,10),sum(IngestTimeLength)
    from   talename
    group by substr(IngestTime,1,10);
      

  4.   

    select sum(ingesttimelength) as year from ingesttime where
    IngestTime between  '2002-08-02 00:00:00' and '2002-08-14 00:00:00' group by substr(IngestTime,1,4) select sum(ingesttimelength) as month from ingesttime where
    IngestTime between  '2002-08-02 00:00:00' and '2002-08-14 00:00:00' group by substr(IngestTime,1,7) select sum(ingesttimelength) as day from ingesttime where
    IngestTime between  '2002-08-02 00:00:00' and '2002-08-14 00:00:00' group by substr(IngestTime,1,10) 
      

  5.   

    这样行吗?
    select sum(IngestTimeLength) from
       (select to_char(IngestTime,'YYYY') year,
               to_char(IngestTime,'YYYYMM') month,
               to_char(IngestTime,'YYYYMMDD') day,
               IngestTimeLength from talename)
    group by year,month,day
      

  6.   

    select sum(IngestTimeLength) from
       (select to_char(IngestTime,'YYYY') year,
               to_char(IngestTime,'YYYY-MM') month,
               to_char(IngestTime,'YYYY-MM-DD') day,
               IngestTimeLength from talename)
    group by year,month,day
    不知行了不?
      

  7.   

    select substr(IngestTime,1,4) as year,
           substr(IngestTime,1,7) as month,
           substr(IngestTime,1,10) as day,
           sum(IngestTimeLength) from table_name
      group by 
        rollup(substr(IngestTime,1,4),substr(IngestTime,1,7),substr(IngestTime,1,10));
    不知道你看不看清楚