救命呀,看看我的视图哪里有错呀create or replace view accounting_balance_fymx as
select
sum(case when account=4101010815 then debet_balance end)     BanGongFei,
sum(case when account=4101010814 then debet_balance end)     YunShuFei,
sum(case when account=218110 then debet_balance end)     GongHuiFei,
sum(case when account=218123 then debet_balance end)     ZhiJiaoFei,
sum(case when account=218102 then debet_balance end)     Yanglaobaoxian,
sum(case when account=218103 then debet_balance end)     jibenyiliaobaoxian,
sum(case when account=218101 then debet_balance end)     zhufanggongjijin,
sum(case when account=218104 then debet_balance end)     shiyebaoxian,
sum(case when account=218113 then debet_balance end)     gongshangbaoxian,
sum(case when account=218112 then debet_balance end)     shengyubaoxian,
sum(case when account=217113 then debet_balance end)     yinhuashui,
sum(case when account=217111 then debet_balance end)     chechuanshui,
sum(case when account=217110 then debet_balance end)     tudishui,
sum(case when account=217109 then debet_balance end)     fangchanshui,
accounting_year,
accounting_period,
rowid                                               objid,                                            
ltrim(lpad(to_char(sysdate,'YYYYMMDDHH24MISS'),2000))  objversion
from
    accounting_balance_tab
where
    accounting_year=2006
and accounting_period=9
group by
   accounting_year,
   accounting_period,
   rowid我要的结果是只要一条数据,
可是加上rowid后
我的结果就出来了一堆的数据,好多,不止一条
但是不加  rowid,我的视图就报错,
有没有兄弟给指点一下,谢谢

解决方案 »

  1.   

    rwoid都是唯一的,当然出来好多数据,而且是不你需要的
      

  2.   


    create or replace view accounting_balance_fymx as
    select
    sum(case when account=4101010815 then debet_balance end)     BanGongFei,
    sum(case when account=4101010814 then debet_balance end)     YunShuFei,
    sum(case when account=218110 then debet_balance end)     GongHuiFei,
    sum(case when account=218123 then debet_balance end)     ZhiJiaoFei,
    sum(case when account=218102 then debet_balance end)     Yanglaobaoxian,
    sum(case when account=218103 then debet_balance end)     jibenyiliaobaoxian,
    sum(case when account=218101 then debet_balance end)     zhufanggongjijin,
    sum(case when account=218104 then debet_balance end)     shiyebaoxian,
    sum(case when account=218113 then debet_balance end)     gongshangbaoxian,
    sum(case when account=218112 then debet_balance end)     shengyubaoxian,
    sum(case when account=217113 then debet_balance end)     yinhuashui,
    sum(case when account=217111 then debet_balance end)     chechuanshui,
    sum(case when account=217110 then debet_balance end)     tudishui,
    sum(case when account=217109 then debet_balance end)     fangchanshui,
    accounting_year,
    accounting_period,
                                             
    ltrim(lpad(to_char(sysdate,'YYYYMMDDHH24MISS'),2000))  objversion
    from
        accounting_balance_tab
    where
        accounting_year=2006
    and accounting_period=9
    group by
       accounting_year,
       accounting_period,
       ltrim(lpad(to_char(sysdate,'YYYYMMDDHH24MISS'),2000)) 
    你改成这样看看