Solved

Agregate function, like sum(), to concatenate strings in group by

Posted on 2003-11-21
4
2,665 Views
Last Modified: 2010-05-18
Oracle8i Enterprise Edition Release 8.1.7.0.0

Let's say i have this data:

Name Hobbies
Joe Read
Joe Sports
Bob Videogames
Bob Sports
Bob Cook

I want a query to generate this output:
Name    Hobbies
Joe      Read, Sports
Bob     Videogames, Sports, Cook

This is pretty much an aggregate function that concatinates text across rows (like sum() adds numbers across rows). Is there such a function? Can I create such a function? Is there another way to do this? My ASPs run the query, but I don't want to have the ASP go through the data and do the grouping. It would be nice if the SQL just returns the data in a state ready to be displayed.
0
Comment
Question by:robysath
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
FBIAGENT earned 200 total points
ID: 9799380
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9799430
of course you can do this in SQL query.
I will direct you to a link (credit to Tom)

http://asktom.oracle.com/pls/ask/f?p=4950:8:3253926000499873802::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:802901216021,
0
 
LVL 2

Expert Comment

by:mahmudaq
ID: 26145251
Broken links for asktom - please copy-paste the solution here.

Thanks,
0
 
LVL 2

Expert Comment

by:mahmudaq
ID: 26145431
I see why you didn't paste it, here's the new link to the same solution:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now