将sql写出来看看,
统计不准是什么意思?

解决方案 »

  1.   

    此SQL为
    SELECT  “2001”||SUBSTR(deal_date,1,4),msc,trunk_groupin,
    trunk_groupout,trunkin_type,trunkin_company,trunkin_feecode,
    trunkout_type,trunkout_company,trunkout_feecode,call_type,
    called_type,fee_type,roam_type,COUNT(*)
    FROM  tg_cdr
     GROUP BY  “2001”||SUBSTR(deal_date,1,4),msc,trunk_groupin,
    trunk_groupout,trunkin_type,trunkin_company,trunkin_feecode,trunkout_type,
    trunkout_company,trunkout_feecode,
    call_type,called_type,fee_type,roam_type;结果不准就是只选出某几天的数据
    如deal_date 为0201 到0220
    可select 出来的缺几天的数据
      

  2.   

    语句没有错误
    因为Group by 语句主要使用了数据库的排序区和临时表空间,请检临时表空间的大小和语句操作时的数据库跟踪文件(.trc),看一看此时数据库有没有出错信息.怀疑由数据库出错而没有得到全部的记录.
    请问这条SQL语句在什么地方执行,自已写的程序还是数据库提供的工具软件?
      

  3.   

    这是oracle8.1.6数据库,是对一张大的表操作(带分区)是自己的程序
    谢谢mycode 的指教,我会再查查的
    等有了新的发现再指教如果能认识你,真是我的荣幸
      

  4.   

    在Sql Plus里执行的结果如何?
      

  5.   

    一样的
    我的临时表空间有4G呀
    好象也没产生什么.trc
    请问数据库的排序区是在哪儿呀
    见笑了
      

  6.   

    我有点怀疑是SUBSTR(DEAL_DATE,1,4)这个条件有问题
      

  7.   

    select c1, c2, ... c15
    (SELECT     “2001”¦¦SUBSTR(deal_date,1,4) as c1,msc as c2,trunk_groupin as c3,
    trunk_groupout as c4,trunkin_type as c5,trunkin_company as c6,trunkin_feecode as c7,
    trunkout_type as c8,trunkout_company as c9,trunkout_feecode as c10,call_type as c11,
    called_type as c12,fee_type as c13,roam_type as c14,COUNT(*) as c15
    FROM     tg_cdr)  as t
    group by c1, c2 ... c15
      

  8.   

    谢谢mycode 的帮助
    问题现已解决
    如下:
    在此表上打开了并行选项
    把此选项关掉,group by 统计正常
    已咨询过oracle技术支持,得到如下建议:
    请将oracle升级到8.1.7