Solved

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

Posted on 2003-11-21
4
2,666 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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

822 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