Advertisement

03.22.2006 at 01:40AM PST, ID: 21783714
[x]
Attachment Details

Select query to get fields from different records into one field of output

Asked by Shweeta in Oracle Database

Tags: different, sql, fields, query, select

I have a table

Field1    Field2      Field3      Field4
-----------------------------------------
a          b             c              12
a          b             c              23
c          d             b              11
a         c              d              88
c         d              b              99

I want a query that would give me rows only for unique combinations of field1, field2 and field3. and for this combination, the fourht field will have values comma separated.

ie.. the output for the above sample data would be:

"a"  "b"  "c"  "12,23"
"c"  "d"  "b"  "11,99"
"a" "c"   "d"  "88"

Is this possible through sql queries only? Or, will I have to take help of stored proc and cursor in cursor logic?

Thanks,
ShwetaStart Free Trial
[+][-]03.22.2006 at 03:41AM PST, ID: 16256499

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Tags: different, sql, fields, query, select
Sign Up Now!
Solution Provided By: Metanil
Participating Experts: 2
Solution Grade: B
 
 
[+][-]03.22.2006 at 07:35AM PST, ID: 16258337

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.30.2006 at 03:52AM PST, ID: 16331128

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32