Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL format resultset dilemma

Status
Not open for further replies.

ttrinh

MIS
Jan 21, 2002
93
0
0
AU
Hi,
I want to return a resultset with a grouping function in it that lists all common items on a single row.
Like if I have a table like so :
Field1 Field2 field3 field 4
-----------------------------------------
1 a a b
1 a a d
1 a c c
I want it to be format like :
Field1 Field2 field3 'result'
-----------------------------------------
1 a a b, d
1 a c c

I am told this is not possible with straight sql(ie group by functions) but how to do it ?
any help appreciated !!
TIA
 
Mockenrue,
Can you elaborate ? possibly with an example? I use PL/SQL but I'm not sure I follow what you mean

thanks
 

I don't know if you're familiar with the PL/SQL Table concept, but with that you can
create temporary arrays in a procedure or function. I did not quite understand your
example case but I guess what you want to do is tallying occurances of combinations.

You can build a PL/SQL table in which you register the combinations encountered and
its count. After that you can present the results by reading from the PL/SQL table.

As I said, I didn't understand the required logic/criteria in your case, so can't give an
example.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top