Home » SQL & PL/SQL » SQL & PL/SQL » Hierarchical Query question
Hierarchical Query question [message #296663] Mon, 28 January 2008 10:22 Go to next message
pw1975
Messages: 24
Registered: June 2006
Junior Member
Hi fellows,

i have a question regarding CONNECT_BY:

The table has 4 columns.
CONTRACT_NUMBER, INVOICE_NUMBER, DESCRIPTION_1, DESCRIPTION_2

example:
1, 10, 'test','test2'
1, 10, 'asdasd',''
1, 11, 'asd',''
2, 50, 'qwewqe',''
2, 51, 'asddsa','asddsa'
2, 51, 'tzuzt','ewrewr'

I want to have the following result:
1,10,'test, test2' <- both descriptions concatenated with comma.
1, 11, 'asd','' <- only one invoice number, so nothing to concatenate
2, 50, 'qwewqe','' <- only one invoice number, so nothing to concatenate
2, 51, 'tzuzt, ewrewr' <- same as first result row

i am sorry, that i can not supply any source code at the moment Sad


Thanks a lot,
Phil
Re: Hierarchical Query question [message #296673 is a reply to message #296663] Mon, 28 January 2008 11:09 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ There are many topics on the subject
2/ There is nothing in your post regarding connect by
3/ please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code.
Use the "Preview Message" button to verify.
4/ You have an example, you can post create table and insert statements.

Regards
Michel

[Updated on: Mon, 28 January 2008 11:09]

Report message to a moderator

Previous Topic: from child to parent node!!
Next Topic: Adding 2 SUM Functions from two tables
Goto Forum:
  


Current Time: Sun Dec 04 00:34:58 CST 2016

Total time taken to generate the page: 0.07923 seconds