This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Data result tree transform algorithm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Data result tree transform algorithm" Watch "Data result tree transform algorithm" New topic

Data result tree transform algorithm

Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 106
The result set like below

L1 L2 L3
1 11 111
1 11 112
1 12 121
1 12 123
2 21 211
2 21 222

Need to output as tree,
output as tree,
L1 L2 L3

1 11 111,112
12 121,123
2 21 221, 222

I can think the basic idea for that to convert it as tree, but a lot of checking and seems very complexity.

it seems a general operation after DB extraction and wonder if there is better or existing soluation?

[ July 18, 2005: Message edited by: Steve Jiang ]
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 29275

Any available solutions probably depend on the output format. What are you trying to create? A web page? A Swing app? Plain text?

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Data result tree transform algorithm
Similar Threads
SCJP 5: Mock questions
How many String objects ... ?!
test bed for array based list implementation
Merging Multiple Lists
want to display the following output?