Not a single-group group function very urgent

HI,
select sum(avg(wait_to))+sum(avg(idle))+sum(avg(users))+sum(avg(system)) from system_cpu
where hostid='DSCP02469' group by cpuid
this query is working
but i want cpuid group to be displayed
so i wrote query like this.
select cpuid,sum(avg(wait_to))+sum(avg(idle))+sum(avg(users))+sum(avg(system)) from system_cpu
where hOstid=' ' group by cpuid it is throwing a error
not a single-group group function.
how can get sum of avg of colums,column based on some coloum
group by column
id,sum(avg( )) i have to get
please give me solution.
send me mail to [email protected]

hi,
thanku for immediate reply but
if i do that
select cpuid, a+b+c+d total_value from (select cpuid,
sum(avg(wait_to)) a, sum(avg(idle)) b,sum(avg(users)) c,sum(avg(system)) d
from system_cpu where hostid='DSCP02469' group by cpuid)
SQL> /
select cpuid, a+b+c+d total_value from (select cpuid,
ERROR at line 1:
ORA-00937: not a single-group group functionelse
select cpuid, a+b+c+d total_value from (select
sum(avg(wait_to)) a, sum(avg(idle)) b,sum(avg(users)) c,sum(avg(system)) d
from system_cpu where hostid='DSCP02469' group by cpuid)
SQL> /
select cpuid, a+b+c+d total_value from (select
ERROR at line 1:
ORA-00904: "CPUID": invalid identifier2)
can we use select in select case
can we use select sal, case when sal then select * from emp like this
with regards
shannu sarma

Similar Messages

  • ORA-00937:not a single-group group function|ORA-06512:at"schema.procedure n

    ORA-00937:not a single-group group function|ORA-06512:at"schema.procedure name)?
    The details of this procedure are the emp table is used in the emp1 which is shown in line 19
    1 DECLARE
    2 cur_emp sys_refcursor;
    3 TYPE t_tab IS TABLE OF emp%ROWTYPE;
    4 tt t_tab;
    5 cur_emp1 sys_refcursor;
    6 TYPE t1_tab IS TABLE OF emp1%ROWTYPE;
    7 tt1 t1_tab;
    8 BEGIN
    9 OPEN cur_emp FOR
    10 SELECT c1,c2,c3 FROM t1,t2,t3 where t1.c1=t2.c2 and t1.c1=t3.c3;
    11 LOOP
    12 FETCH cur_emp BULK COLLECT INTO tt LIMIT 100000;
    13 EXIT WHEN tt.COUNT=0;
    14 FOR i IN 1..tt.COUNT LOOP
    15 insert in to emp (c1,c2,c3) values (tt(i).c1,tt(i).c2,tt(i).c3;
    16 END LOOP;
    17 END LOOP;
    18 OPEN cur_emp FOR
    19 SELECT c11,c12,c13 FROM emp,t12,t13 where emp.c11=t12.c12 and t11.c11=t13.c13;
    20 LOOP
    21 FETCH cur_emp1 BULK COLLECT INTO tt1 LIMIT 100000;
    22 EXIT WHEN tt1.COUNT=0;
    23 FOR j IN 1..tt1.COUNT LOOP
    24 insert in to emp1 (c11,c12,c13) values (tt1(j).c11,tt1(j).c12,tt1(j).c13;
    25 END LOOP;
    26 END LOOP;
    27 END;
    /

    ORA-00937:not a single-group group function|ORA-06512:at"schema.procedure name)?
    The details of this procedure are the emp table is used in the emp1 which is shown in line 19
    1 DECLARE
    2 cur_emp sys_refcursor;
    3 TYPE t_tab IS TABLE OF emp%ROWTYPE;
    4 tt t_tab;
    5 cur_emp1 sys_refcursor;
    6 TYPE t1_tab IS TABLE OF emp1%ROWTYPE;
    7 tt1 t1_tab;
    8 BEGIN
    9 OPEN cur_emp FOR
    10 SELECT c1,c2,c3 FROM t1,t2,t3 where t1.c1=t2.c2 and t1.c1=t3.c3;
    11 LOOP
    12 FETCH cur_emp BULK COLLECT INTO tt LIMIT 100000;
    13 EXIT WHEN tt.COUNT=0;
    14 FOR i IN 1..tt.COUNT LOOP
    15 insert in to emp (c1,c2,c3) values (tt(i).c1,tt(i).c2,tt(i).c3);
    16 END LOOP;
    17 END LOOP;
    18 OPEN cur_emp FOR
    19 SELECT c11,c12,c13 FROM emp,t12,t13 where emp.c11=t12.c12 and emp.c11=t13.c13;
    20 LOOP
    21 FETCH cur_emp1 BULK COLLECT INTO tt1 LIMIT 100000;
    22 EXIT WHEN tt1.COUNT=0;
    23 FOR j IN 1..tt1.COUNT LOOP
    24 insert in to emp1 (c11,c12,c13) values (tt1(j).c11,tt1(j).c12,tt1(j).c13);
    25 END LOOP;
    26 END LOOP;
    27 END;

  • Issue with not a single-group group function error

    Hello PL/SQL Gurus,
    I am using Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production version and
    Once I am using the following query –
    SELECT s.sym,
    t.tag_trade_method trade_method,
    astd.tag_trade_sector,
    iss.gics_sector_dsc sector,
    d.date_dt trade_date,
    c.wmc_curcy_cd_alpha curcycode,
    amd.brkr_nm,
    SUM(atdf.notional_amt) trd_notional,
    SUM(atdf.trd_qty) trd_qty,
    ard.buy_sell_ind,
    td.person_init
    FROM alloc_tran_det_fact atdf,
    date_dim d,
    alloc_trade_tag_dim t,
    security_dim s,
    currency_dim c,
    person_dim td,
    access_method_dim amd,
    alloc_sec_tag_dim astd,
    alloc_ref_dim ard,
    issuer_dim iss
    where atdf.alloc_trd_tag_dim_key = t.alloc_trade_tag_dim_key AND
    atdf.alloc_sec_tag_dim_key = astd.alloc_sec_tag_dim_key AND
    ard.alloc_ref_dim_key = atdf.alloc_ref_dim_key AND
    atdf.isr_dim_key = iss.isr_dim_key AND
    atdf.trd_dt_key = d.date_dim_key AND
    atdf.sec_dim_key = s.sec_dim_key AND
    t.tag_valid_trade_flg = 'Y' AND
    atdf.locl_curcy_flg = 'Y' AND
    d.date_dim_key BETWEEN 20120405 AND 20120405 AND
    c.curcy_dim_key = atdf.curcy_dim_key AND
    td.person_dim_key = atdf.trdr_dim_key AND
    atdf.exec_brkr_dim_key = amd.access_method_dim_key AND
    amd.level_cd = 'B'
    and t.tag_trade_method in('ALGO','CAPITAL','DMA','NATURAL','WORKING')
    then it throw the error –
    ORA-00937: not a single-group group function
    If I am using something like –
    SELECT s.sym,
    t.tag_trade_method trade_method,
    astd.tag_trade_sector,
    iss.gics_sector_dsc sector,
    d.date_dt trade_date,
    c.wmc_curcy_cd_alpha curcycode,
    amd.brkr_nm,
    SUM(atdf.notional_amt) trd_notional,
    SUM(atdf.trd_qty) trd_qty,
    td.person_init
    FROM alloc_tran_det_fact atdf,
    date_dim d,
    alloc_trade_tag_dim t,
    security_dim s,
    currency_dim c,
    person_dim td,
    access_method_dim amd,
    alloc_sec_tag_dim astd,
    issuer_dim iss
    WHERE atdf.alloc_trd_tag_dim_key = t.alloc_trade_tag_dim_key AND
    atdf.alloc_sec_tag_dim_key = astd.alloc_sec_tag_dim_key AND
    atdf.isr_dim_key = iss.isr_dim_key AND
    atdf.trd_dt_key = d.date_dim_key AND
    atdf.sec_dim_key = s.sec_dim_key AND
    t.tag_valid_trade_flg = 'Y' AND
    atdf.locl_curcy_flg = 'Y' AND
    d.date_dim_key BETWEEN 20120102 AND 20120401 AND
    c.curcy_dim_key = atdf.curcy_dim_key AND
    td.person_dim_key = atdf.trdr_dim_key AND
    atdf.exec_brkr_dim_key = amd.access_method_dim_key AND
    amd.level_cd = 'B'
    and t.tag_trade_method in('ALGO','CAPITAL','DMA','NATURAL','WORKING')
    GROUP BY t.tag_trade_method,
    d.date_dt,
    c.wmc_curcy_cd_alpha,
    td.person_init,
    amd.brkr_nm,
    astd.tag_trade_sector,
    iss.gics_sector_dsc
    then it works fine. I know that due to aggeregate functions we need to use Group By, but why to put Group By on different non aggregate columns,
    As my intension is to fetch the records for defined date range Group By Symbol (s.sym), Kindly help me with this. 
    Thanks to all of you in advance for providing you valuable time and efforts.
    Edited by: user555994 on May 11, 2012 2:20 AM

    You do need to group by these columns
    t.tag_trade_method,
    d.date_dt,
    c.wmc_curcy_cd_alpha,
    td.person_init,
    amd.brkr_nm,
    astd.tag_trade_sector,
    iss.gics_sector_dsc
    as they don't have aggregate functions applied to them.

  • Help with 'not a single-group group function' error

    I have the following statement which gives me that error and don't know what's wrong.
    select BUDGET_CODE,
    to_char(sum(HOURS + (MINUTES/60) + OVERTIME_HOURS + (OVERTIME_MINUTES/60)+(sum(stat)/count(distinct BUDGET_CODE)) * WAGE),'L999999999.00') as Cost
    from KTT_INFORMATION i
    inner join KTT_WAGES w on i.NAME = w.NAME
    GROUP BY BUDGET_CODE
    The statement was working and I added:
    +(sum(stat)/count(distinct BUDGET_CODE))
    which works in a separate statement of its own. Any help is appreciated.

    Although, if you're doing a count on BUDGET_CODE while at the same time grouping by that same field, you'll always get a 1 back from count() in this query, so you may need to modify that anyway.

  • Samrtform function not getting called....VERY URGENT

    Hello friends,
    i created a smartform ZIBFIFORM_VOUCHER2,and am calling it in my driver program.
    it returns exception 3..(send error)..
    why?
    if i comment control and output and usersettings..the form is called..
    strange huh?
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname = 'ZIBFIFORM_VOUCHER2'
      IMPORTING
        fm_name  = p_function.
        CALL FUNCTION p_function
          EXPORTING
           CONTROL_PARAMETERS         = p_control
           OUTPUT_OPTIONS             = p_output
           USER_SETTINGS              = ''
            WAG_BKPF                   = wag_bkpf
         IMPORTING
           DOCUMENT_OUTPUT_INFO       = document_output_info
           JOB_OUTPUT_INFO            = job_output_info
           JOB_OUTPUT_OPTIONS         = job_output_options
          TABLES
            ITG_BSEG                   = itg_bseg1
         EXCEPTIONS
           FORMATTING_ERROR           = 1
           INTERNAL_ERROR             = 2
           SEND_ERROR                 = 3
           USER_CANCELED              = 4
           OTHERS                     = 5
        IF SY-SUBRC <> 0.
    MESSAGE e012 WITH 'Error in Display'.
    ENDIF.

    Hi,
    Please with folllowing details:
    DATA: wa_output_options TYPE ssfcompop,
    wa_ctrl TYPE ssfctrlop.
    wa_output_options-tdimmed = 'X'.
    wa_output_options-tddelete = 'X'.
    wa_output_options-tdimmed = ' '.
    wa_output_options-tddest = 'LOCL'.
    wa_ctrl-no_dialog = 'X'.
    CALL FUNCTION lv_fm_name
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = wa_ctrl
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = wa_output_options
    user_settings = ' '
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    If helpful points(don't forget).

  • Decode (function) VERY URGENT ! ! !

    Hi Folks,
    Does any one know how can i use some thing like
    if a < 25 then
    else
    end if;
    using decode function.
    Thanks in advance
    D'Silva

    Yep use Decode in conjunction with
    the sign() function.
    Goes something like this...
    Decode( Sign( a - 25 ),0, 'EQUAL',
    1, 'GREATER',
    -1, 'LESS' )
    Hope this helps
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by D'Silva:
    Hi Folks,
    Does any one know how can i use some thing like
    if a < 25 then
    else
    end if;
    using decode function.
    Thanks in advance
    D'Silva<HR></BLOCKQUOTE>
    null

  • How to display single row column with nested group function

    SQL> select deptno, Max(sum(sal)) SalSum
    2 from emp
    3 group by deptno;
    select deptno, Max(sum(sal)) SalSum
    ERROR at line 1:
    ORA-00937: not a single-group group function
    Can you please the Help me to get the Max(sum(sal)) with Deptno ......

    select deptno, sum(sal) SalSum
    from emp
    group by deptno;The ablove query will give only one value for SALSUM for a department. So there is no meaning on applying MAX on this for a department..
    What are you trying to achieve?
    This?
    select max(salsum) salsm,max(deptno) keep(dense_rank first order by salsum desc) deptno
    from(
    select deptno, sum(sal) SalSum
    from emp
    group by deptno);Edited by: jeneesh on Sep 4, 2012 6:00 PM

  • Sql group function

    I am trying to calculate the average cost of the books for each customer. The output should contain the customer#, name and the average order.
    This is the code I have:
    SELECT AVG(SUM((retail-cost)*quantity))
    FROM orders JOIN orderitems USING (order#)
    JOIN books USING (isbn)
    JOIN customers USING (customer#)
    GROUP BY order#, customer#;
    I get either, over 8000 for the average order or about 33 for the average order when I don't include the name, customer number or anything else in the code. If I add any other information, I get:
    SELECT customer#, AVG(SUM((retail-cost)*quantity))
    ERROR at line 1:
    ORA-00937: not a single-group group function
    I'm sure there is something small that I am missing, but cannot see it.

    Hi,
    Whenever you have a question, you should post a little sample data and the results you want to get from that data.
    I don't know where you're coming from, or where you want ot go, so it's hard to give you good directions. All I have is your current route plan, which must be incorrect, or else you wouldn't be asking anything.
    I see you are nesting aggregate functions. That's very rare in real life, and the result is always to produce one row of output, regardless of what's in the GROUP BY clause.
    I suspect you want to do a SUM in a sub-query, and then do AVG on the results in the main query. Without seeing your sample data and desired results, I'm just guessing.

  • Error in nested group function used with column name.

    Hi Team,
    If i used nested group function with column name its not working. Could you please any one suggest me.
    How to use it.
    Regards,
    Venkat.
    Please find Spool ........
    SQL> select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
    2 group by user_name,CNT;
    select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
    ERROR at line 1:
    ORA-00937: not a single-group group function
    SQL> select max(max(CNT)) from(select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
    2 group by user_name;
    MAX(MAX(CNT))
    605

    Venkat wrote:
    Hi Sayan
    Its giving output like below, but not given maximum CNT.
    SQL> select user_name,max(CNT)from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
    2 group by user_name;
    USER_NAME MAX(CNT)
    BANES_LERG 6
    VENE_USER 8
    USER3 339
    DBUS 106
    VEL_USER 37
    SYS 597
    6 rows selected.Check it - Re: Error in nested group function used with column name.
    and previous post

  • Group function problem

    Hi, I need to list the shortest string along with the number of characters in the string, so far I've come up with:
    SELECT eventtitle, MIN(LENGTH(eventtitle))
    FROM event
    Oracle XE is giving the error "not a single-group group function", but I can't quite see how to get "eventtitle" on it's own, the function "MIN(LENGTH(eventtitle))" does give me the desired result if run by its self. I'm grateful for any assistance!

      1  with t
      2  as
      3  (
      4   select 'abcd' short_string from dual
      5   union all
      6   select 'a' short_string from dual
      7   union all
      8   select 'b' from dual
      9  )
    10  select short_string, rownum rn from t
    11* order by length(short_string)
    SQL> /
    SHOR         RN
    a             2
    b             3
    abcd          1one version using analytics
      1  with t
      2  as
      3  (
      4   select 'abcd' short_string from dual
      5   union all
      6   select 'a' short_string from dual
      7   union all
      8   select 'b' from dual
      9  )
    10  select short_string, len from
    11  (
    12  select short_string, length(short_string) len, min(length(short_string)) over() min_length from t
    13* ) where len = min_length
    SQL>
    SHOR        LEN
    a             1
    b             1Regards
    Raj

  • Update Equipment BOM using Function module (very urgent)

    Hi All,
    I am an ABAPER and trying to update equipemnt BOM.
    I want to update equipment BOM using a function module. I am currently using 'CSAI_BOM_MAINTAIN' function module. But i am not able to update the Equipment BOM. After function call the sy-subrc value is 0, even though the BOM is not updated.
    Please help its very urgent.
    Kind Regards,
    Sharat.

    Hi Sharat,
    I am facing the same problem. Could you please let me know what might be the reason.
    Plz mail me at [email protected]
    Plz update this section once u have mailed the answer.
    Thanks a lot in advance.
    Regards,
    Himanshu

  • Very Very Urgent Issue: Restricted Key Figure does not return any data

    Hi all,
    Please help me solving this urgent issue.
    created customer exit variable on characterstics version and also
    other customer exit variable on Value type.
    I coded that in variable exit. Problem is when I include these in
    restrickted keyfigure My query does not return me any data.
    But if I remove from restrickted key firgure and put it as normal
    charaterstics I see the variable is getting populated.
    Also in RSRT the SQl generated when these are included in RKF is not
    correct.
    I debugged and know they are getting populated. As when included in RKF
    I can also see the values of customer exit variables from information
    tab.
    I also know that there is data in cube for those restrictions.
    I posted one OSS Notes regarding this urgent issue. But got no reply from SAP.
    FYI: We are using BEx 3.5 Browser SAP GUI 6.4 Patch 20 BW Patch 11
    Thanks
    SAP BW
    **Please do not post the same question twice: Very Urgent Issue: Restricted Key Figure does not return any data

    Hi,
    Everyone out there this is very urgent. If someone can help me solving this problem.
    We are using BEx 3.5 Browser SAP GUI 6.4 Patch 20 BW Patch 11.
    I posted one oss notes also regarding this issue. But got no reply from SAP.
    So, Please help me solving this issue.
    Thanks
    SAP BW

  • How can shrink matrix group very urgent

    hello programmers
    how r u all? i have a little problem. i want to shrink my matrix frame when i donot want to print all columns of matrix group in report. suppose i haev three matrix groups and i want matrix group 2 all columns to be hide at runtime and matrix three group will automatically come at the position of matrix 2 group. please if ant body have any idea about it please email me. this is very urgent problem which i am facing.
    thanks for any reply
    kamran ahmed

    It's not very clear what you're looking for. However, one of the following may work for you:
    a) Restrict the data at query time through use of parameters and bind variables.
    b) Use format triggers to dynamically hide values at runtime (by returning false).
    If neither of these solutions works then please provide more details of the problem you're facing.
    Thanks,
    Danny

  • Very Urgent Extn.Material Group and Material Group.

    Hi Guru's,
          I was created Generic D.S Using table (AFRU) for Orders Confirmation.I was Created Info Source AND ODS.
         I nedd to maitain ODS Extn.Material Group and Material Group.but These fields are not Avilable in Data Source (AFRU Table not having).
        Data source having Field AUFNR (order number) I was mapped To BW Object 0prodorder. I was maitained master data for 0prodorder.
      0prodorder master data (0prodorder_attr) having 0material (PLNBEZ Field mapeed to 0material) as a navigational Attribute.
    i am asking to all is it possible to bring Extn.Material Group and Material Group update rule level using master data attribute option?
    Please help to me Above issue.it's very urgent.
    Thanks & Regards,
    Guna.

    Hi Manju & Gopi,
        This Order Confirmations cube having data from 2 data sources.
        There is a performence issue to clubbing so many tables.
         Any way i was maitained 0material is attribute(Nav Attr) of 0proorder.i was loaded 0prodoreder master data.
       0material having master data .Extn mat group & Material group are Nav Attributes of 0material.
      Now is it possible to maitaining the data in cube Extn mat group & Material group ?
    Please Give me Suggestion with out adding another table using view.
    Thanks & Regards,
    Guna.

  • PL/SQL equivalent of T-SQL - "group function is not allowed here"

    Hi all, hope someone can give me a hand as I'm pretty stuck! I have been trying to convert some MS SQL Server T-SQL statements into Oracle PL/SQL and am stuck on the below one:
    SELECT
    CA.AssessmentID,
    (SELECT ProductName + ISNULL(' - ' + PrincipalBenefit,'')
    FROM rptPolicySnapshot WHERE PolicyID = MAX(CA.PolicyID)
    AND SnapshotID = 1),
    MAX(CA.PolicyID)
    FROM rptClaimInvoiceLineSnapshot CIL
    INNER JOIN rptClaimAssessmentSnapshot CA
    ON CIL.AssessmentID = CA.AssessmentID
    AND CIL.SnapshotID = CA.SnapshotID
    WHERE CIL.SnapshotID = 1
    GROUP BY CA.AssessmentID
    This works fine in MSSQL but returns the below error in Oracle:
    'ORA-00934: group function is not allowed here'
    If I take out the subquery the query works fine.
    Any ideas as to the syntax? I am new to Oracle so not sure as to how I should go about writing this.
    Thanks in advance!
    Leo

    WITH x AS (SELECT   ca.assessmentid,
                        MAX (ca.policyid) policy_id
               FROM rptclaiminvoicelinesnapshot cil
                    INNER JOIN rptclaimassessmentsnapshot ca
                        ON cil.assessmentid = ca.assessmentid
                       AND cil.snapshotid = ca.snapshotid
               WHERE cil.snapshotid = 1
               GROUP BY ca.assessmentid
    SELECT x.assessment_id,
           x.policy_id,
           productname + decode(principalbenefit,null,null,' - ' || principalbenefit ) prodname
    FROM   rptpolicysnapshot, x
    WHERE  policyid = x.policy_id
    AND    snapshotid = 1I think that's in the neighbourhood.

Maybe you are looking for