MySQL Forums
Forum List  »  MySQL Workbench

SQL query to find new column
Posted by: Abhishek Jaiswal
Date: July 26, 2017 09:54AM

I need your help. I have a table named Test_Result with 2 columns as shown below.

ID Source_ID
10 1
20 2
30 2
40 3
50 3
60 3
70 4
I am trying to get output as below,but unable to get logic.

ID Parent_ID Source_ID
10 Null 1
20 Null 2
30 20 2
40 Null 3
50 40 3
60 50 3
70 Null 4
Kindly help me with this scenario. I attached question in picture for as well.

Regards, Abhi

Options: ReplyQuote


Subject
Views
Written By
Posted
SQL query to find new column
154
July 26, 2017 09:54AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.