Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2008
    Posts
    464

    Unanswered: .....is a group by expression.....

    Hi

    Please excuse me if my question is naive...

    Code:
    select TRUNC(DATETIME,'MM') DATETIME
    
    ,BSC as BSC
    
    ,SUM(NVL(TASSALL,0)) as CALL_VOLUME
    
    ,ROUND((DIV(NVL(TCASSALL,0),NVL(TASSALL,0))),2)*100 as T_AS_SUCC
    
    from ERIC.CELLS
     
    WHERE DATETIME BETWEEN to_date('01/09/2009 00:00:00','DD-MM-YYYY HH24:MI:SS') and to_date('30/09/2009 23:59:59','DD-MM-YYYY HH24:MI:SS') 
     
    group by datetime,bsc
    When I run this, I get TCASSALL not a group by expression.

    Now my problem is I don't want to group by TFCASSAL. I only want to group by DATETIME, BSC.

    CELLS is a table. Do I need to create a VIEW of it?

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    When you have an aggregate function like sum, all other items must be grouped by. at the end of your query type

    group by datetime,tcassall
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Aug 2008
    Posts
    464
    Thanks but I did this and then the result is also grouped by TCASSALL which is not what I want. I only want to group by datetime, bsc.

    Plus if I remove the line:

    ,ROUND((DIV(NVL(TCASSALL,0),NVL(TASSALL,0))),2)*10 0 as T_AS_SUCC

    and then run the query, it runs fine and groups by datetime, bsc.

  4. #4
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Great and i agree if you dont want to group by tcassall then you have to remove it from the query. Nice fix.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •