Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Group by error : not a GROUP BY expression

677253Dec 25 2008 — edited Dec 29 2008
Hello,

Table subscriber looks like this :

| OBJECTKEY | NAME |
| 1 | Maxim |


Table subscriber_locations looks like this :

| PARENTKEY | OBJECTKEY | location_id |
| 1 | 1 | 83 |
| 1 | 2 | 14 |
My motivation is a view that would return the following result :

| subscriber.OBJECTKEY | subscriber.NAME | locationCollection |
| 1 | MAXIM | 83,14 |
For this I've tried the folllwing but this fails with "not a GROUP BY expression"


CREATE VIEW SUBSCRIBER_SINGLEROW_CSV AS SELECT 
    subscriber.*, wmsys.wm_concat(subscriber_locations.location_id) locationCollection
FROM
   subscriber, subscriber_locations
WHERE
   subscriber.objectkey = subscriber_locations.parentkey
GROUP BY subscriber.objectkey
;{code}

Even when I try something simplier such as the example below I get the group by error, what am I doing wrong?
{code:sql}select subscriber.objectkey, subscriber_locations.location_id from subscriber, subscriber_locations where 
subscriber.objectkey = subscriber_locations.parentkey GROUP BY subscriber.objectkey;
{code}



Thank you for helping.

Edited by: user10197381 on Dec 25, 2008 11:16 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2009
Added on Dec 25 2008
16 comments
1,112 views