not a GROUP BY expression
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: not a GROUP BY expression

  1. #1
    Join Date
    Jun 2003
    Posts
    24

    not a GROUP BY expression

    hello all,

    when i run the following query

    Select MAX(BRANCH.NAME) BRNAME,
    MAX(CUSTOMER.CUSTNAME) CUSTNAME,
    MAX(Extn.Item_ID)
    from CUSTOMER,BRANCH,Order
    (Select OrdItm_A.Item_ID,
    from OrdItm OrdItm_A
    where
    OrdItm_A.OrdID=Order.OrdID
    ) Extn
    Where
    extn.OrdID=Order.OrdID
    Group by Branch.Branch_ID
    /

    It shows the following error though
    i have put all the fields in MAX condition

    Select MAX(BRANCH.NAME) BRNAME,
    *
    ERROR at line 1:
    ORA-00979: not a GROUP BY expression


    Thanx.

  2. #2
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    1) Comma missing after
    from CUSTOMER,BRANCH,Order
    this might explain the syntax error.

    2) No join conditions on BRANCH and CUSTOMER => Cartesian product. I doubt if you want that.

    3) It doesn't make sense to me, not to have Branch.Branch_ID in the Select clause - how do you know which result row referrs to which group?

  3. #3
    Join Date
    Nov 2004
    Location
    India
    Posts
    9

    Reply

    Hi,

    The group by should include BRANCH.NAME,CUSTOMER.CUSTNAME,Extn.Item_ID ALL THE 3.

    Please check and get back of any errors are there as i have not tested this stuff i told you.

    Regards,
    Jigar D Pota
    Oracle Certified DBA
    India
    98791 88534
    (The Final Frontier !!)

  4. #4
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142

    Re: Reply

    Originally posted by jigarpota
    The group by should include BRANCH.NAME,CUSTOMER.CUSTNAME,Extn.Item_ID ALL THE 3.
    Why?
    Originally posted by jigarpota
    . . . i have not tested this stuff . . . .
    Quite.

  5. #5
    Join Date
    Oct 2004
    Posts
    8
    It should be group by BRANCH.NAME

  6. #6
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    I haven't been able to reproduce this diagnostic. I don't think it's worth spending more time on this, since santo didn't come back.

    BTW, there's another error in the query:
    OrdItm_A.OrdID=Order.OrdID

Posting Permissions

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


Click Here to Expand Forum to Full Width