Solved

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

Posted on 2003-11-21
4
2,669 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

724 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