Quantcast
Channel: MySQL Forums - MySQL Workbench
Viewing all articles
Browse latest Browse all 3724

SQL query to find new column (no replies)

$
0
0
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

Viewing all articles
Browse latest Browse all 3724

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>