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.
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?
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 !!)
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.
It should be group by BRANCH.NAME
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
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks